mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
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
51 lines
1.4 KiB
Nix
51 lines
1.4 KiB
Nix
{ 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;
|
|
};
|
|
}
|