refactor(deploy): set up tailnet 'colmena' deploy

This commit is contained in:
2026-06-15 08:35:49 +02:00
parent e845834833
commit c19d6b3152
8 changed files with 11 additions and 16 deletions
+4 -3
View File
@@ -12,7 +12,7 @@ let
hostname: hostname:
let let
meta = utils.hostMeta ../hosts/${hostname}; meta = utils.hostMeta ../hosts/${hostname};
isLocal = builtins.elem "local" meta.tags; isArm = meta.system == "aarch64-linux";
in in
{ {
imports = [ ../hosts/${hostname} ]; imports = [ ../hosts/${hostname} ];
@@ -20,8 +20,9 @@ let
deployment = { deployment = {
inherit (meta) tags; inherit (meta) tags;
targetUser = meta.host.username; targetUser = meta.host.username;
targetHost = if isLocal then "" else hostname; targetHost = hostname;
buildOnTarget = builtins.any (t: t != "local" && t != "arm") meta.tags; allowLocalDeployment = meta.host.admin or false;
buildOnTarget = !isArm;
}; };
}; };
+1 -7
View File
@@ -19,14 +19,11 @@ let
colmena = inputs.colmena.packages.${pkgs.stdenv.hostPlatform.system}.colmena; colmena = inputs.colmena.packages.${pkgs.stdenv.hostPlatform.system}.colmena;
hostTags = hostname: (myUtils.hostMeta (hostDir + "/${hostname}")).tags; hostTags = hostname: (myUtils.hostMeta (hostDir + "/${hostname}")).tags;
remoteHostsWithKeys = lib.filter (
hostname: !(builtins.elem "local" (hostTags hostname))
) hostsWithKeys;
nodeTagsDecl = '' nodeTagsDecl = ''
declare -A _colmena_node_tags=( declare -A _colmena_node_tags=(
${lib.concatMapStringsSep "\n" ( ${lib.concatMapStringsSep "\n" (
hostname: " [${hostname}]=${lib.escapeShellArg (lib.concatStringsSep " " (hostTags hostname))}" hostname: " [${hostname}]=${lib.escapeShellArg (lib.concatStringsSep " " (hostTags hostname))}"
) remoteHostsWithKeys} ) hostsWithKeys}
) )
''; '';
@@ -56,12 +53,9 @@ in
hostname: hostname:
let let
meta = myUtils.hostMeta (hostDir + "/${hostname}"); meta = myUtils.hostMeta (hostDir + "/${hostname}");
isLocal = builtins.elem "local" meta.tags;
in in
{ {
User = meta.host.username; User = meta.host.username;
}
// lib.optionalAttrs (!isLocal) {
HostName = hostname; HostName = hostname;
ControlPath = "~/.ssh/socket-%r@%h:%p"; ControlPath = "~/.ssh/socket-%r@%h:%p";
} }
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "desktop"; role = "desktop";
tags = [ "local" ]; tags = [ "personal" ];
host = { host = {
username = "h"; username = "h";
highRam = true; highRam = true;
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "laptop"; role = "laptop";
tags = [ "local" ]; tags = [ "personal" ];
host = { host = {
username = "h"; username = "h";
highRam = true; highRam = true;
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
system = "aarch64-linux"; system = "aarch64-linux";
role = "embedded"; role = "embedded";
tags = [ "arm" ]; tags = [ "lab" ];
host = { host = {
username = "h"; username = "h";
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
system = "aarch64-linux"; system = "aarch64-linux";
role = "embedded"; role = "embedded";
tags = [ "arm" ]; tags = [ "lab" ];
host = { host = {
username = "h"; username = "h";
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "server"; role = "server";
tags = [ "cloud" ]; tags = [ "lab" ];
host = { host = {
username = "username"; username = "username";
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
system = "x86_64-linux"; system = "x86_64-linux";
role = "vm"; role = "vm";
tags = [ "local" ]; tags = [ "lab" ];
host = { host = {
username = "h"; username = "h";
}; };