From ed39959b611d6f77421d19fb28bb7d1590e14bbf Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Wed, 11 Mar 2026 14:49:04 +0100 Subject: [PATCH] feat(deploy): add deployment tags for each host --- deploy/colmena.nix | 14 +++++++++----- hosts/andromache/meta.nix | 4 ++++ hosts/astyanax/meta.nix | 4 ++++ hosts/eetion-02/meta.nix | 4 ++++ hosts/eetion/meta.nix | 4 ++++ hosts/hecuba/meta.nix | 4 ++++ hosts/vm/meta.nix | 4 ++++ utils/default.nix | 5 +++++ 8 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 hosts/andromache/meta.nix create mode 100644 hosts/astyanax/meta.nix create mode 100644 hosts/eetion-02/meta.nix create mode 100644 hosts/eetion/meta.nix create mode 100644 hosts/hecuba/meta.nix create mode 100644 hosts/vm/meta.nix 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}"; }