diff --git a/deploy/colmena.nix b/deploy/colmena.nix index 981a85a..9581027 100644 --- a/deploy/colmena.nix +++ b/deploy/colmena.nix @@ -4,6 +4,10 @@ }: let + inherit (inputs.nixpkgs) lib; + utils = import ../utils { inherit lib; }; + hostDirNames = utils.dirNames ../hosts; + mkNode = hostname: tags: { imports = [ ../hosts/${hostname} ]; deployment = { @@ -13,6 +17,10 @@ let inherit tags; }; }; + + nodes = lib.genAttrs hostDirNames (hostname: + mkNode hostname (utils.hostMeta ../hosts/${hostname}).deployment.tags + ); in inputs.colmena.lib.makeHive { meta = { @@ -24,9 +32,5 @@ inputs.colmena.lib.makeHive { nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs or { }) self.nixosConfigurations; }; - astyanax = mkNode "astyanax" [ "local" ]; - andromache = mkNode "andromache" [ "local" ]; - vm = mkNode "vm" [ "local" ]; - hecuba = mkNode "hecuba" [ "cloud" ]; - eetion = mkNode "eetion" [ "arm" ]; + inherit nodes; } diff --git a/hosts/andromache/meta.nix b/hosts/andromache/meta.nix new file mode 100644 index 0000000..0139f26 --- /dev/null +++ b/hosts/andromache/meta.nix @@ -0,0 +1,4 @@ +{ + deployment.tags = [ "local" ]; + role = "desktop"; +} diff --git a/hosts/astyanax/meta.nix b/hosts/astyanax/meta.nix new file mode 100644 index 0000000..d0c4fcc --- /dev/null +++ b/hosts/astyanax/meta.nix @@ -0,0 +1,4 @@ +{ + deployment.tags = [ "local" ]; + role = "laptop"; +} diff --git a/hosts/eetion-02/meta.nix b/hosts/eetion-02/meta.nix new file mode 100644 index 0000000..c064d2f --- /dev/null +++ b/hosts/eetion-02/meta.nix @@ -0,0 +1,4 @@ +{ + deployment.tags = [ "arm" ]; + role = "embedded"; +} diff --git a/hosts/eetion/meta.nix b/hosts/eetion/meta.nix new file mode 100644 index 0000000..c064d2f --- /dev/null +++ b/hosts/eetion/meta.nix @@ -0,0 +1,4 @@ +{ + deployment.tags = [ "arm" ]; + role = "embedded"; +} diff --git a/hosts/hecuba/meta.nix b/hosts/hecuba/meta.nix new file mode 100644 index 0000000..d11d1cf --- /dev/null +++ b/hosts/hecuba/meta.nix @@ -0,0 +1,4 @@ +{ + deployment.tags = [ "cloud" ]; + role = "server"; +} diff --git a/hosts/vm/meta.nix b/hosts/vm/meta.nix new file mode 100644 index 0000000..9123f0d --- /dev/null +++ b/hosts/vm/meta.nix @@ -0,0 +1,4 @@ +{ + deployment.tags = [ "local" ]; + role = "vm"; +} diff --git a/utils/default.nix b/utils/default.nix index f0e9c4a..372e7a5 100644 --- a/utils/default.nix +++ b/utils/default.nix @@ -3,4 +3,9 @@ { dirNames = path: builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir path)); + + hostMeta = hostDir: + if builtins.pathExists (hostDir + "/meta.nix") + then import (hostDir + "/meta.nix") + else throw "meta.nix required in ${hostDir}"; }