feat(deploy): add deployment tags for each host
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
4
hosts/andromache/meta.nix
Normal file
4
hosts/andromache/meta.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
deployment.tags = [ "local" ];
|
||||
role = "desktop";
|
||||
}
|
||||
4
hosts/astyanax/meta.nix
Normal file
4
hosts/astyanax/meta.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
deployment.tags = [ "local" ];
|
||||
role = "laptop";
|
||||
}
|
||||
4
hosts/eetion-02/meta.nix
Normal file
4
hosts/eetion-02/meta.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
deployment.tags = [ "arm" ];
|
||||
role = "embedded";
|
||||
}
|
||||
4
hosts/eetion/meta.nix
Normal file
4
hosts/eetion/meta.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
deployment.tags = [ "arm" ];
|
||||
role = "embedded";
|
||||
}
|
||||
4
hosts/hecuba/meta.nix
Normal file
4
hosts/hecuba/meta.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
deployment.tags = [ "cloud" ];
|
||||
role = "server";
|
||||
}
|
||||
4
hosts/vm/meta.nix
Normal file
4
hosts/vm/meta.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
deployment.tags = [ "local" ];
|
||||
role = "vm";
|
||||
}
|
||||
@@ -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}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user