-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib.nix
32 lines (32 loc) · 970 Bytes
/
lib.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let
defineSystems = inputs: let
systems = builtins.mapAttrs (k: _v: builtins.readDir ./systems/${k}) (builtins.readDir ./systems);
nixosConfiguration = system: hostName:
inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit system;
inherit hostName;
};
modules = [
./systems/${system}/${hostName}/configuration.nix
];
};
configurationAttrs = builder: arch:
builtins.map (hostName: {
name = hostName;
value = builder arch hostName;
}) (builtins.attrNames systems.${arch});
nixosConfigurations = let
nixosConfigurationAttrs = aarch: configurationAttrs nixosConfiguration aarch;
in
builtins.listToAttrs (nixosConfigurationAttrs "aarch64-linux" ++ nixosConfigurationAttrs "x86_64-linux");
in {
inherit nixosConfigurations;
};
lib = {
inherit defineSystems;
};
in
lib