diff --git a/flake.nix b/flake.nix index cd135a9..a9ac2dc 100644 --- a/flake.nix +++ b/flake.nix @@ -69,7 +69,22 @@ nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes; - colmena = { + colmena = let + commonModules = [ + inputs.agenix.nixosModules.default + inputs.hydra.nixosModules.hydra + + ./services + ./common + ]; + + makeBuilder = i: lib.nameValuePair "builder-${toString i}" { + imports = commonModules; + bagel.baremetal.builders = { enable = true; num = i; }; + }; + + builders = lib.listToAttrs (lib.genList makeBuilder 12); + in { meta.nixpkgs = import nixpkgs { localSystem = system; overlays = [ @@ -80,72 +95,11 @@ }; meta.specialArgs.inputs = inputs; - bagel-box = { - imports = [ - inputs.agenix.nixosModules.default - inputs.hydra.nixosModules.hydra - - ./services - ./common - ./hosts/bagel-box - ]; - }; - - meta01 = { - imports = [ - inputs.agenix.nixosModules.default - inputs.hydra.nixosModules.hydra - - ./services - ./common - ./hosts/meta01.nixpkgs.lahfa.xyz - ]; - }; - - gerrit01 = { - imports = [ - inputs.agenix.nixosModules.default - inputs.hydra.nixosModules.hydra - - ./services - ./common - ./hosts/cl.forkos.org - ]; - }; - - fodwatch = { - imports = [ - inputs.agenix.nixosModules.default - inputs.hydra.nixosModules.hydra - - ./services - ./common - ./hosts/fodwatch.forkos.org - ]; - }; - - wob-vpn-gw = { - imports = [ - inputs.agenix.nixosModules.default - inputs.hydra.nixosModules.hydra - - ./services - ./common - ./hosts/wob-vpn-gw.forkos.org - ]; - }; - - } // (lib.listToAttrs (lib.genList (i: lib.nameValuePair "builder-${toString i}" { - - imports = [ - inputs.agenix.nixosModules.default - inputs.hydra.nixosModules.hydra - ./services - ./common - { - bagel.baremetal.builders = { enable = true; num = i; }; - } - ]; - }) 12)); + bagel-box.imports = commonModules ++ [ ./hosts/bagel-box ]; + meta01.imports = commonModules ++ [ ./hosts/meta01 ]; + gerrit01.imports = commonModules ++ [ ./hosts/gerrit01 ]; + fodwatch.imports = commonModules ++ [ ./hosts/fodwatch ]; + wob-vpn-gw.imports = commonModules ++ [ ./hosts/wob-vpn-gw ]; + } // builders; }; } diff --git a/hosts/fodwatch.forkos.org/default.nix b/hosts/fodwatch/default.nix similarity index 100% rename from hosts/fodwatch.forkos.org/default.nix rename to hosts/fodwatch/default.nix diff --git a/hosts/cl.forkos.org/default.nix b/hosts/gerrit01/default.nix similarity index 100% rename from hosts/cl.forkos.org/default.nix rename to hosts/gerrit01/default.nix diff --git a/hosts/meta01.nixpkgs.lahfa.xyz/default.nix b/hosts/meta01/default.nix similarity index 100% rename from hosts/meta01.nixpkgs.lahfa.xyz/default.nix rename to hosts/meta01/default.nix diff --git a/hosts/wob-vpn-gw.forkos.org/default.nix b/hosts/wob-vpn-gw/default.nix similarity index 100% rename from hosts/wob-vpn-gw.forkos.org/default.nix rename to hosts/wob-vpn-gw/default.nix