outputs: factor out mkNixosSystem
I hope this makes this file more readable
This commit is contained in:
parent
081c00b7bc
commit
5d9f3332b8
1 changed files with 15 additions and 14 deletions
29
outputs.nix
29
outputs.nix
|
@ -20,6 +20,20 @@ self = {
|
|||
};
|
||||
nixosConfigurations = let
|
||||
nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix";
|
||||
mkNixosSystem = path: nixosSystem {
|
||||
inherit lib;
|
||||
modules = [
|
||||
path
|
||||
{
|
||||
config.nixpkgs.overlays = [
|
||||
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } )
|
||||
( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" )
|
||||
self.overlays.versionInfoFixup
|
||||
];
|
||||
}
|
||||
];
|
||||
specialArgs = { inherit self inputs; };
|
||||
};
|
||||
in
|
||||
# mapped attrset of nix file paths to attrSet with initialized NixOS configurations,
|
||||
# whose names are derived from file names
|
||||
|
@ -37,20 +51,7 @@ self = {
|
|||
# remove .nix extension
|
||||
name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name;
|
||||
# initialize NixOS configuration
|
||||
value = nixosSystem {
|
||||
inherit lib;
|
||||
modules = [
|
||||
./hosts/${name}
|
||||
{
|
||||
config.nixpkgs.overlays = [
|
||||
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } )
|
||||
( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" )
|
||||
self.overlays.versionInfoFixup
|
||||
];
|
||||
}
|
||||
];
|
||||
specialArgs = { inherit self inputs; };
|
||||
};
|
||||
value = mkNixosSystem ./hosts/${name};
|
||||
}))
|
||||
builtins.attrValues
|
||||
builtins.listToAttrs
|
||||
|
|
Loading…
Add table
Reference in a new issue