outputs: use lib.pipe in nixosConfigurations
This commit is contained in:
parent
f39c0b54d0
commit
4f10f70c70
1 changed files with 28 additions and 24 deletions
52
outputs.nix
52
outputs.nix
|
@ -14,39 +14,43 @@ self = {
|
||||||
versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; };
|
versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; };
|
||||||
};
|
};
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
dir = builtins.readDir ./hosts;
|
|
||||||
# list nix file paths in ./hosts to attributes in nixosConfigurations
|
# list nix file paths in ./hosts to attributes in nixosConfigurations
|
||||||
filePaths = lib.mapAttrsToList (name: _: name) (lib.filterAttrs (name: type:
|
filePaths = lib.pipe ./hosts [
|
||||||
|
builtins.readDir
|
||||||
|
( lib.filterAttrs (name: type:
|
||||||
# filter out non-nix files
|
# filter out non-nix files
|
||||||
type == "regular"
|
type == "regular"
|
||||||
# filter out files that don't end in .nix
|
# filter out files that don't end in .nix
|
||||||
&& lib.hasSuffix ".nix" name
|
&& lib.hasSuffix ".nix" name
|
||||||
# filter out files that start with .
|
# filter out files that start with .
|
||||||
&& ! lib.hasPrefix "." name
|
&& !lib.hasPrefix "." name
|
||||||
) dir
|
))
|
||||||
);
|
(lib.mapAttrsToList (name: _: name))
|
||||||
|
];
|
||||||
nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix";
|
nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix";
|
||||||
in
|
in
|
||||||
# mapped list of nix file paths to attrSet with initialized NixOS configurations,
|
# mapped list of nix file paths to attrSet with initialized NixOS configurations,
|
||||||
# whose names are derived from file names
|
# whose names are derived from file names
|
||||||
builtins.listToAttrs (builtins.map (name: {
|
lib.pipe filePaths [
|
||||||
name = builtins.substring 0 (builtins.stringLength name - 4) name;
|
(builtins.map (name: {
|
||||||
value = nixosSystem {
|
name = builtins.substring 0 (builtins.stringLength name - 4) name;
|
||||||
inherit lib;
|
value = nixosSystem {
|
||||||
modules = [
|
inherit lib;
|
||||||
./hosts/${name}
|
modules = [
|
||||||
{
|
./hosts/${name}
|
||||||
config.nixpkgs.overlays = [
|
{
|
||||||
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ./.}/pkgs/top-level/impure.nix"; } )
|
config.nixpkgs.overlays = [
|
||||||
( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" "${builtins.toString ./.}/pkgs/by-name" )
|
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ./.}/pkgs/top-level/impure.nix"; } )
|
||||||
self.overlays.versionInfoFixup
|
( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" "${builtins.toString ./.}/pkgs/by-name" )
|
||||||
];
|
self.overlays.versionInfoFixup
|
||||||
}
|
];
|
||||||
];
|
}
|
||||||
specialArgs = { inherit self inputs; };
|
];
|
||||||
};
|
specialArgs = { inherit self inputs; };
|
||||||
}) filePaths
|
};
|
||||||
);
|
}))
|
||||||
|
builtins.listToAttrs
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
in self
|
in self
|
||||||
|
|
Loading…
Reference in a new issue