feat(deploy): add deployment tags for each host

This commit is contained in:
2026-03-11 14:49:04 +01:00
parent 828b5d7374
commit ed39959b61
8 changed files with 38 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -0,0 +1,4 @@
{
deployment.tags = [ "local" ];
role = "desktop";
}

4
hosts/astyanax/meta.nix Normal file
View File

@@ -0,0 +1,4 @@
{
deployment.tags = [ "local" ];
role = "laptop";
}

4
hosts/eetion-02/meta.nix Normal file
View File

@@ -0,0 +1,4 @@
{
deployment.tags = [ "arm" ];
role = "embedded";
}

4
hosts/eetion/meta.nix Normal file
View File

@@ -0,0 +1,4 @@
{
deployment.tags = [ "arm" ];
role = "embedded";
}

4
hosts/hecuba/meta.nix Normal file
View File

@@ -0,0 +1,4 @@
{
deployment.tags = [ "cloud" ];
role = "server";
}

4
hosts/vm/meta.nix Normal file
View File

@@ -0,0 +1,4 @@
{
deployment.tags = [ "local" ];
role = "vm";
}

View File

@@ -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}";
}