feat(deploy): add deployment tags for each host
This commit is contained in:
@@ -4,6 +4,10 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (inputs.nixpkgs) lib;
|
||||||
|
utils = import ../utils { inherit lib; };
|
||||||
|
hostDirNames = utils.dirNames ../hosts;
|
||||||
|
|
||||||
mkNode = hostname: tags: {
|
mkNode = hostname: tags: {
|
||||||
imports = [ ../hosts/${hostname} ];
|
imports = [ ../hosts/${hostname} ];
|
||||||
deployment = {
|
deployment = {
|
||||||
@@ -13,6 +17,10 @@ let
|
|||||||
inherit tags;
|
inherit tags;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nodes = lib.genAttrs hostDirNames (hostname:
|
||||||
|
mkNode hostname (utils.hostMeta ../hosts/${hostname}).deployment.tags
|
||||||
|
);
|
||||||
in
|
in
|
||||||
inputs.colmena.lib.makeHive {
|
inputs.colmena.lib.makeHive {
|
||||||
meta = {
|
meta = {
|
||||||
@@ -24,9 +32,5 @@ inputs.colmena.lib.makeHive {
|
|||||||
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs or { }) self.nixosConfigurations;
|
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs or { }) self.nixosConfigurations;
|
||||||
};
|
};
|
||||||
|
|
||||||
astyanax = mkNode "astyanax" [ "local" ];
|
inherit nodes;
|
||||||
andromache = mkNode "andromache" [ "local" ];
|
|
||||||
vm = mkNode "vm" [ "local" ];
|
|
||||||
hecuba = mkNode "hecuba" [ "cloud" ];
|
|
||||||
eetion = mkNode "eetion" [ "arm" ];
|
|
||||||
}
|
}
|
||||||
|
|||||||
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 =
|
dirNames =
|
||||||
path: builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir path));
|
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