outputs: factor out mkNixosSystem

I hope this makes this file more readable
This commit is contained in:
Wroclaw 2025-02-09 03:52:25 +01:00
parent 081c00b7bc
commit 5d9f3332b8

View file

@ -20,6 +20,20 @@ self = {
}; };
nixosConfigurations = let nixosConfigurations = let
nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; 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 in
# mapped attrset of nix file paths to attrSet with initialized NixOS configurations, # mapped attrset of nix file paths to attrSet with initialized NixOS configurations,
# whose names are derived from file names # whose names are derived from file names
@ -37,20 +51,7 @@ self = {
# remove .nix extension # remove .nix extension
name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name;
# initialize NixOS configuration # initialize NixOS configuration
value = nixosSystem { value = mkNixosSystem ./hosts/${name};
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; };
};
})) }))
builtins.attrValues builtins.attrValues
builtins.listToAttrs builtins.listToAttrs