|
| 1 | +{ self |
| 2 | +, inputs |
| 3 | +, lib |
| 4 | +, ... |
| 5 | +}: |
| 6 | +let |
| 7 | + inherit (lib) nixosSystem cartesianProduct; |
| 8 | + inherit (self.lib) genAttrs' listNixName; |
| 9 | + x86_64-hosts = cartesianProduct { |
| 10 | + name = listNixName ./x86_64-linux; |
| 11 | + system = [ "x86_64-linux" ]; |
| 12 | + }; |
| 13 | + aarch64-hosts = cartesianProduct { |
| 14 | + name = listNixName ./aarch64-linux; |
| 15 | + system = [ "aarch64-linux" ]; |
| 16 | + }; |
| 17 | + hosts = x86_64-hosts ++ aarch64-hosts; |
| 18 | +in |
| 19 | +{ |
| 20 | + flake = { |
| 21 | + nixosConfigurations = genAttrs' hosts ( |
| 22 | + host: |
| 23 | + (nixosSystem { |
| 24 | + inherit (host) system; |
| 25 | + specialArgs = { |
| 26 | + inherit inputs self; |
| 27 | + pkgs-self = self.legacyPackages.${host.system}; |
| 28 | + }; |
| 29 | + modules = [ |
| 30 | + "${self}/hosts/${host.system}/${host.name}.nix" |
| 31 | + self.nixosModules.default |
| 32 | + inputs.colmena.nixosModules.deploymentOptions |
| 33 | + ]; |
| 34 | + }) |
| 35 | + ); |
| 36 | + colmena = |
| 37 | + (genAttrs' hosts (host: { |
| 38 | + imports = [ |
| 39 | + # SSH to llmnr hosts need retry to wait for hostname resolution. |
| 40 | + # Requires colmena version > 0.5.0. |
| 41 | + # { deployment.sshOptions = [ "-o" "ConnectionAttempts=2" ]; } |
| 42 | + "${self}/hosts/${host.system}/${host.name}.nix" |
| 43 | + self.nixosModules.default |
| 44 | + ]; |
| 45 | + })) |
| 46 | + // { |
| 47 | + meta = { |
| 48 | + nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; |
| 49 | + machinesFile = "/etc/nix/machines"; |
| 50 | + nodeNixpkgs = genAttrs' hosts |
| 51 | + (host: (import inputs.nixpkgs { inherit (host) system; })); |
| 52 | + nodeSpecialArgs = genAttrs' hosts |
| 53 | + (host: { inherit inputs self; pkgs-self = self.legacyPackages.${host.system}; }); |
| 54 | + }; |
| 55 | + }; |
| 56 | + }; |
| 57 | +} |
0 commit comments