flakelike
This commit is contained in:
parent
9cd9d8fe3c
commit
ba94153c3b
8 changed files with 221 additions and 0 deletions
53
outputs.nix
Normal file
53
outputs.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{ inputs ? import ./inputs.nix {}
|
||||
, selfPath ? builtins.toString ./.
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib/overlays/version-info-fixup.nix { inherit inputs; });
|
||||
|
||||
self = {
|
||||
inherit lib;
|
||||
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
|
||||
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
|
||||
overlays = {
|
||||
selfExpr = import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = inputs.nixpkgs; };
|
||||
unstable = import ./pkgs/overlays/unstable.nix;
|
||||
versionInfoFixup = import ./pkgs/overlays/version-info-fixup.nix { inherit inputs; };
|
||||
};
|
||||
nixosConfigurations = let
|
||||
dir = builtins.readDir ./hosts;
|
||||
# list nix file paths in ./hosts to attributes in nixosConfigurations
|
||||
filePaths = lib.mapAttrsToList (name: _: name) (lib.filterAttrs (name: type:
|
||||
# filter out non-nix files
|
||||
type == "regular"
|
||||
# filter out files that don't end in .nix
|
||||
&& lib.hasSuffix ".nix" name
|
||||
# filter out files that start with .
|
||||
&& ! lib.hasPrefix "." name
|
||||
) dir
|
||||
);
|
||||
nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix";
|
||||
in
|
||||
# mapped list of nix file paths to attrSet with initialized NixOS configurations,
|
||||
# whose names are derived from file names
|
||||
builtins.listToAttrs (builtins.map (name: {
|
||||
name = builtins.substring 0 (builtins.stringLength name - 4) name;
|
||||
value = nixosSystem {
|
||||
inherit lib;
|
||||
modules = [
|
||||
./hosts/${name}
|
||||
{
|
||||
config.nixpkgs.overlays = [
|
||||
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = ./pkgs/top-level/impure.nix; } )
|
||||
self.overlays.versionInfoFixup
|
||||
];
|
||||
}
|
||||
];
|
||||
specialArgs = { inherit self inputs; };
|
||||
};
|
||||
}) filePaths
|
||||
);
|
||||
};
|
||||
|
||||
in self
|
Loading…
Add table
Add a link
Reference in a new issue