mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-26 10:48:35 +02:00
flake: partition dev dependencies
This removes the need for end-users to manually set `nixvim.inputs.devshell.follows = ""` (etc) We offload evaluation of some of our flake modules into a `dev` partition submodule. - When its not needed, this submodule is not evaluated. - When it is needed, it fetches extra inputs from `flake/dev/flake.nix` as part of evaluating the submodule. See https://flake.parts/options/flake-parts-partitions.html
This commit is contained in:
parent
0ab9947137
commit
6d10fc0c87
16 changed files with 366 additions and 285 deletions
51
flake/dev/template-tests.nix
Normal file
51
flake/dev/template-tests.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
# The following adds the template flake's checks to the main (current) flake's checks.
|
||||
# It ensures that the template's own checks are successful.
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
checks =
|
||||
let
|
||||
# Approximates https://github.com/NixOS/nix/blob/96e550ef/src/libexpr/call-flake.nix#L67-L85
|
||||
callFlake =
|
||||
flake@{
|
||||
inputs,
|
||||
outputs,
|
||||
sourceInfo ? { },
|
||||
}:
|
||||
let
|
||||
outputs = flake.outputs (inputs // { self = result; });
|
||||
result =
|
||||
outputs
|
||||
// sourceInfo
|
||||
// {
|
||||
inherit inputs outputs sourceInfo;
|
||||
_type = "flake";
|
||||
};
|
||||
in
|
||||
result;
|
||||
|
||||
flakes = lib.mapAttrs (
|
||||
name: template:
|
||||
callFlake {
|
||||
# Use inputs from our flake
|
||||
inputs = {
|
||||
inherit (inputs) flake-parts nixpkgs;
|
||||
nixvim = self;
|
||||
};
|
||||
# Use outputs from the template flake
|
||||
inherit (import "${template.path}/flake.nix") outputs;
|
||||
}
|
||||
) self.templates;
|
||||
in
|
||||
lib.concatMapAttrs (name: flake: {
|
||||
"template-${name}" = pkgs.linkFarm name flake.checks.${system};
|
||||
}) flakes;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue