Merge hosts and deployments with a simpler and clearer hosts definition

This commit is contained in:
pazpi 2025-12-03 16:07:59 +01:00
parent f244d787be
commit b6b2774414
4 changed files with 233 additions and 219 deletions

View file

@ -2,10 +2,21 @@
let
p = import ./parameters.nix;
hosts = p.hosts;
hostDefs = import ./hosts.nix;
# Generate complete colmena host configs (imports + deployment)
mkColmenaHosts = builtins.mapAttrs (name: cfg: {
imports = inputs.self.nixosConfigurations.${name}._module.args.modules;
deployment = {
targetHost = hosts.${name} or null;
tags = cfg.tags;
};
}) hostDefs;
in
{
mkColmenaHosts
// {
meta = {
# Configuration used by colmena to build
nixpkgs = import inputs.nixpkgs {
system = "x86_64-linux";
overlays = [ ];
@ -15,179 +26,20 @@ in
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs) inputs.self.nixosConfigurations;
};
arr.deployment = {
targetHost = hosts.arr;
tags = [
"lxc"
"bacco"
"arr"
];
# Special hosts not defined in hosts.nix
baseLXC = {
imports = inputs.self.nixosConfigurations.baseLXC._module.args.modules;
deployment = {
targetHost = null;
tags = [ "template" ];
};
};
caddy.deployment = {
targetHost = hosts.caddy;
tags = [
"lxc"
"bacco"
"arr"
"auth"
"metrics"
"nextcloud"
"portainer"
"vaultwarden"
"immich"
"firefly-iii"
"paperless"
];
deadbeef = {
deployment = {
allowLocalDeployment = true;
targetHost = null;
tags = [ "local" ];
};
};
metrics.deployment = {
targetHost = hosts.metrics;
tags = [
"lxc"
"bacco"
"metrics"
];
};
nextcloud.deployment = {
targetHost = hosts.nextcloud;
tags = [
"lxc"
"bacco"
"nextcloud"
];
};
vaultwarden.deployment = {
targetHost = hosts.vaultwarden;
tags = [
"lxc"
"bacco"
"vaultwarden"
];
};
plex.deployment = {
targetHost = hosts.plex;
tags = [
"lxc"
"node"
];
};
portainer.deployment = {
targetHost = hosts.portainer;
tags = [
"lxc"
"bacco"
"portainer"
];
};
authentik.deployment = {
targetHost = hosts.authentik;
tags = [
"lxc"
"bacco"
"auth"
];
};
colmena.deployment = {
targetHost = hosts.colmena;
tags = [
"lxc"
"bacco"
"colmena"
];
};
dns01.deployment = {
targetHost = hosts.dns01;
tags = [
"lxc"
"bacco"
"dns"
];
};
dns02.deployment = {
targetHost = hosts.dns02;
tags = [
"lxc"
"bacco"
"dns"
];
};
shadowsocks.deployment = {
targetHost = hosts.shadowsocks;
tags = [
"lxc"
"bacco"
"shadowsocks"
];
};
immich.deployment = {
targetHost = hosts.immich;
tags = [
"lxc"
"bacco"
"immich"
];
};
firefly-iii.deployment = {
targetHost = hosts.firefly-iii;
tags = [
"lxc"
"bacco"
"firefly-iii"
];
};
paperless.deployment = {
targetHost = hosts.paperless;
tags = [
"lxc"
"bacco"
"paperless"
];
};
zigbee2mqtt.deployment = {
targetHost = hosts.zigbee2mqtt;
tags = [
"lxc"
"bacco"
"zigbee2mqtt"
];
};
forgejo.deployment = {
targetHost = hosts.forgejo;
tags = [
"lxc"
"bacco"
"forgejo"
];
};
n8n.deployment = {
targetHost = hosts.n8n;
tags = [
"lxc"
"bacco"
"n8n"
];
};
deadbeef.deployment = {
allowLocalDeployment = true;
targetHost = null;
tags = [ "local" ];
};
}