We actually do not depend on any input here. Only if a nixosConfiguration should be instantiated, but it is already expected that the user will provide a (more up-to-date) nixpkgs flake that we use.
19 lines
1 KiB
Nix
19 lines
1 KiB
Nix
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
|
system = hostname: { namespace ? "fbs42", nixpkgs ? "nixpkgs" }: inputs.${nixpkgs}.lib.nixosSystem {
|
|
specialArgs = { inherit inputs flake namespace; };
|
|
modules = builtins.concatLists (map (base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })) flake.lib.schema.base)
|
|
++ [ { config.networking.hostName = hostname; } ]
|
|
++ [ nixosModules.default ]
|
|
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
|
imports = [ inputs.home-manager.nixosModules.default ];
|
|
config.home-manager = {
|
|
sharedModules = [ hmModules.default ];
|
|
extraSpecialArgs = { inherit flake namespace; };
|
|
};
|
|
}
|
|
++ builtins.attrValues nixosUsers
|
|
++ builtins.attrValues nixosGroups
|
|
;
|
|
};
|
|
|
|
in builtins.mapAttrs (name: value: assert builtins.length value == 1; system name (builtins.head value)) host
|