From b93e634a0403def746b2ba2ab7d1642b27124d04 Mon Sep 17 00:00:00 2001 From: clerie Date: Mon, 3 Oct 2022 15:26:15 +0200 Subject: [PATCH] flake: restructure host defition and add hosts to hydra --- flake.nix | 153 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 112 insertions(+), 41 deletions(-) diff --git a/flake.nix b/flake.nix index 517ed11..ac306b2 100644 --- a/flake.nix +++ b/flake.nix @@ -11,57 +11,126 @@ }; system = "x86_64-linux"; in { + nixosConfigurations = { + backup-4 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/backup-4/configuration.nix + ]; + }; + carbon = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/carbon/configuration.nix + ]; + }; + clerie-backup = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/clerie-backup/configuration.nix + ]; + }; + dn42-il-gw1 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/dn42-il-gw1/configuration.nix + ]; + }; + dn42-il-gw5 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/dn42-il-gw5/configuration.nix + ]; + }; + dn42-il-gw6 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/dn42-il-gw6/configuration.nix + ]; + }; + dn42-ildix-clerie = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/dn42-ildix-clerie/configuration.nix + ]; + }; + gatekeeper = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/gatekeeper/configuration.nix + ]; + }; + hydra-1 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/hydra-1/configuration.nix + ]; + }; + minecraft-2 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/minecraft-2/configuration.nix + ]; + }; + monitoring-3 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/monitoring-3/configuration.nix + ]; + }; + nonat = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/nonat/configuration.nix + ]; + }; + osmium = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/osmium/configuration.nix + ]; + }; + palladium = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/palladium/configuration.nix + ]; + }; + porter = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/porter/configuration.nix + ]; + }; + storage-2 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/storage-2/configuration.nix + ]; + }; + web-2 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/web-2/configuration.nix + ]; + }; + }; + colmena = { meta = { nixpkgs = import nixpkgs {}; }; defaults = { name, ... }: { - imports = [ - (./. + "/hosts/${name}/configuration.nix") - ]; deployment = { targetHost = "${name}.net.clerie.de"; targetUser = null; }; }; - - # Hosts - - backup-4 = { ... }: {}; - - carbon = { ... }: {}; - - clerie-backup = { ... }: {}; - - dn42-il-gw1 = { ... }: {}; - - dn42-il-gw5 = { ... }: {}; - - dn42-il-gw6 = { ... }: {}; - - dn42-ildix-clerie = { ... }: {}; - - gatekeeper = { ... }: {}; - - hydra-1 = { ... }: {}; - - minecraft-2 = { ... }: {}; - - monitoring-3 = { ... }: {}; - - nonat = { ... }: {}; - - osmium = { ... }: {}; - - palladium = { ... }: {}; - - porter = { ... }: {}; - - storage-2 = { ... }: {}; - - web-2 = { ... }: {}; - }; + } // builtins.mapAttrs (name: host: { + nixpkgs.system = host.config.nixpkgs.system; + imports = host._module.args.modules; + }) self.nixosConfigurations; packages.x86_64-linux = { inherit (pkgs) @@ -75,7 +144,9 @@ }; hydraJobs = { - inherit (self) packages; + inherit (self) + packages; + nixosConfigurations = builtins.mapAttrs (name: host: host.config.system.build.toplevel) self.nixosConfigurations; }; }; }