|
63 | 63 | } |
64 | 64 | ]; |
65 | 65 | }; |
| 66 | + |
| 67 | + # All host module paths in one place. |
| 68 | + # Most hosts can be instantiated with mkNixOS; hetzci-vm is created by mkHetzciVm. |
| 69 | + hostModules = { |
| 70 | + hetzarm = ./builders/hetzarm/configuration.nix; |
| 71 | + hetzarm-dbg-1 = ./builders/hetzarm-dbg-1/configuration.nix; |
| 72 | + hetzarm-rel-1 = ./builders/hetzarm-rel-1/configuration.nix; |
| 73 | + testagent-prod = ./testagent/prod/configuration.nix; |
| 74 | + testagent-dev = ./testagent/dev/configuration.nix; |
| 75 | + testagent2-prod = ./testagent/prod2/configuration.nix; |
| 76 | + testagent-release = ./testagent/release/configuration.nix; |
| 77 | + nethsm-gateway = ./nethsm-gateway/configuration.nix; |
| 78 | + ghaf-log = ./ghaf-log/configuration.nix; |
| 79 | + ghaf-webserver = ./ghaf-webserver/configuration.nix; |
| 80 | + ghaf-auth = ./ghaf-auth/configuration.nix; |
| 81 | + ghaf-monitoring = ./ghaf-monitoring/configuration.nix; |
| 82 | + ghaf-lighthouse = ./ghaf-lighthouse/configuration.nix; |
| 83 | + ghaf-fleetdm = ./ghaf-fleetdm/configuration.nix; |
| 84 | + ghaf-registry = ./ghaf-registry/configuration.nix; |
| 85 | + hetzci-dbg = ./hetzci/dbg/configuration.nix; |
| 86 | + hetzci-dev = ./hetzci/dev/configuration.nix; |
| 87 | + hetzci-prod = ./hetzci/prod/configuration.nix; |
| 88 | + hetzci-release = ./hetzci/release/configuration.nix; |
| 89 | + hetzci-vm = ./hetzci/vm/configuration.nix; |
| 90 | + hetz86-1 = ./builders/hetz86-1/configuration.nix; |
| 91 | + hetz86-builder = ./builders/hetz86-builder/configuration.nix; |
| 92 | + hetz86-dbg-1 = ./builders/hetz86-dbg-1/configuration.nix; |
| 93 | + hetz86-rel-2 = ./builders/hetz86-rel-2/configuration.nix; |
| 94 | + uae-lab-node1 = ./uae/lab/node1/configuration.nix; |
| 95 | + uae-nethsm-gateway = ./uae/nethsm-gateway/configuration.nix; |
| 96 | + uae-azureci-prod = ./uae/azureci/prod/configuration.nix; |
| 97 | + uae-azureci-az86-1 = ./uae/azureci/builders/az86-1/configuration.nix; |
| 98 | + uae-testagent-prod = ./uae/testagent/prod/configuration.nix; |
| 99 | + }; |
| 100 | + |
| 101 | + nixosModulesFromHosts = lib.mapAttrs' ( |
| 102 | + name: path: lib.nameValuePair "nixos-${name}" path |
| 103 | + ) hostModules; |
| 104 | + |
| 105 | + nixosConfigurationsFromHosts = builtins.mapAttrs (name: _path: mkNixOS { systemName = name; }) ( |
| 106 | + lib.removeAttrs hostModules [ "hetzci-vm" ] |
| 107 | + ); |
66 | 108 | in |
67 | 109 | { |
68 | 110 | flake.nixosModules = { |
69 | 111 | # shared modules |
70 | 112 | common = import ./common.nix; |
71 | | - |
72 | | - # All flake.nixosConfigurations, before we call lib.nixosSystem over them. |
73 | | - # We use a 'nixos-' prefix to distinguish them from regular modules. |
74 | | - # |
75 | | - # These are available to allow extending system configuration with |
76 | | - # out-of-tree additional config (like additional trusted cache public keys) |
77 | | - nixos-hetzarm = ./builders/hetzarm/configuration.nix; |
78 | | - nixos-hetzarm-dbg-1 = ./builders/hetzarm-dbg-1/configuration.nix; |
79 | | - nixos-hetzarm-rel-1 = ./builders/hetzarm-rel-1/configuration.nix; |
80 | | - nixos-testagent-prod = ./testagent/prod/configuration.nix; |
81 | | - nixos-testagent-dev = ./testagent/dev/configuration.nix; |
82 | | - nixos-testagent2-prod = ./testagent/prod2/configuration.nix; |
83 | | - nixos-testagent-release = ./testagent/release/configuration.nix; |
84 | | - nixos-nethsm-gateway = ./nethsm-gateway/configuration.nix; |
85 | | - nixos-ghaf-log = ./ghaf-log/configuration.nix; |
86 | | - nixos-ghaf-webserver = ./ghaf-webserver/configuration.nix; |
87 | | - nixos-ghaf-auth = ./ghaf-auth/configuration.nix; |
88 | | - nixos-ghaf-monitoring = ./ghaf-monitoring/configuration.nix; |
89 | | - nixos-ghaf-lighthouse = ./ghaf-lighthouse/configuration.nix; |
90 | | - nixos-ghaf-fleetdm = ./ghaf-fleetdm/configuration.nix; |
91 | | - nixos-ghaf-registry = ./ghaf-registry/configuration.nix; |
92 | | - nixos-hetzci-dbg = ./hetzci/dbg/configuration.nix; |
93 | | - nixos-hetzci-dev = ./hetzci/dev/configuration.nix; |
94 | | - nixos-hetzci-prod = ./hetzci/prod/configuration.nix; |
95 | | - nixos-hetzci-release = ./hetzci/release/configuration.nix; |
96 | | - nixos-hetzci-vm = ./hetzci/vm/configuration.nix; |
97 | | - nixos-hetz86-1 = ./builders/hetz86-1/configuration.nix; |
98 | | - nixos-hetz86-builder = ./builders/hetz86-builder/configuration.nix; |
99 | | - nixos-hetz86-dbg-1 = ./builders/hetz86-dbg-1/configuration.nix; |
100 | | - nixos-hetz86-rel-2 = ./builders/hetz86-rel-2/configuration.nix; |
101 | | - nixos-uae-lab-node1 = ./uae/lab/node1/configuration.nix; |
102 | | - nixos-uae-nethsm-gateway = ./uae/nethsm-gateway/configuration.nix; |
103 | | - nixos-uae-azureci-prod = ./uae/azureci/prod/configuration.nix; |
104 | | - nixos-uae-azureci-az86-1 = ./uae/azureci/builders/az86-1/configuration.nix; |
105 | | - nixos-uae-testagent-prod = ./uae/testagent/prod/configuration.nix; |
106 | | - }; |
| 113 | + } |
| 114 | + // nixosModulesFromHosts; |
107 | 115 |
|
108 | 116 | # Expose as flake.lib.mkNixOS. |
109 | 117 | flake.lib = { |
110 | 118 | inherit mkNixOS; |
111 | 119 | }; |
112 | 120 |
|
113 | | - # for each systemName, call mkNixOS on it, and set flake.nixosConfigurations |
114 | | - # to an attrset from systemName to the result of that mkNixOS call. |
115 | | - flake.nixosConfigurations = |
116 | | - (builtins.listToAttrs ( |
117 | | - builtins.map |
118 | | - (name: { |
119 | | - inherit name; |
120 | | - value = mkNixOS { systemName = name; }; |
121 | | - }) |
122 | | - [ |
123 | | - "hetzarm" |
124 | | - "hetzarm-dbg-1" |
125 | | - "hetzarm-rel-1" |
126 | | - "testagent-prod" |
127 | | - "testagent-dev" |
128 | | - "testagent2-prod" |
129 | | - "testagent-release" |
130 | | - "nethsm-gateway" |
131 | | - "ghaf-log" |
132 | | - "ghaf-webserver" |
133 | | - "ghaf-auth" |
134 | | - "ghaf-monitoring" |
135 | | - "ghaf-lighthouse" |
136 | | - "ghaf-fleetdm" |
137 | | - "ghaf-registry" |
138 | | - "hetzci-dbg" |
139 | | - "hetzci-dev" |
140 | | - "hetzci-prod" |
141 | | - "hetzci-release" |
142 | | - "hetz86-1" |
143 | | - "hetz86-builder" |
144 | | - "hetz86-dbg-1" |
145 | | - "hetz86-rel-2" |
146 | | - "uae-lab-node1" |
147 | | - "uae-nethsm-gateway" |
148 | | - "uae-azureci-prod" |
149 | | - "uae-azureci-az86-1" |
150 | | - "uae-testagent-prod" |
151 | | - ] |
152 | | - )) |
153 | | - // { |
154 | | - hetzci-vm = mkHetzciVm { }; |
155 | | - hetzci-vm-no-host-nix-store = mkHetzciVm { |
156 | | - mountHostNixStore = false; |
157 | | - }; |
| 121 | + flake.nixosConfigurations = nixosConfigurationsFromHosts // { |
| 122 | + hetzci-vm = mkHetzciVm { }; |
| 123 | + hetzci-vm-no-host-nix-store = mkHetzciVm { |
| 124 | + mountHostNixStore = false; |
158 | 125 | }; |
| 126 | + }; |
159 | 127 | } |
0 commit comments