use colmena apply-local

This commit is contained in:
Henri Dohmen 2026-01-13 18:34:48 +01:00
parent 4cb9acc4f9
commit 9f9a4d0377
Signed by: hd
GPG key ID: AB79213B044674AE
2 changed files with 58 additions and 22 deletions

View file

@ -65,27 +65,51 @@
secrets = lib'.walk-dir ./secrets; secrets = lib'.walk-dir ./secrets;
}; };
mkDesktop = mkModule =
host: {
nixpkgs.lib.nixosSystem { entry,
system = "x86_64-linux"; isServer ? false,
specialArgs = specialArgs // { }:
inherit host; {
}; imports = [
modules = [ entry
(./host + "/${host}")
./home
./mod ./mod
]; ]
++ (if isServer then [ ] else [ ./home ]);
}; };
# Not exposed as flake outputs because they depend on specialArgs
# if you add a host, make sure to add it to var/default.nix as well
nixosModules = {
"solo" = mkModule { entry = ./host/solo; };
"c2" = mkModule { entry = ./host/c2; };
"fw" = mkModule { entry = ./host/fw; };
"roam" = mkModule {
entry = ./host/roam;
isServer = true;
};
};
in in
{ {
nixosConfigurations = { nixosConfigurations =
# if you add a host, make sure to add it to var/default.nix as well let
"solo" = mkDesktop "solo"; mkDesktop = host: {
"c2" = mkDesktop "c2"; name = host;
"fw" = mkDesktop "fw"; value = nixpkgs.lib.nixosSystem {
}; system = "x86_64-linux";
inherit specialArgs;
modules = [ (nixosModules.${host}) ];
};
};
in
lib.listToAttrs (
map mkDesktop [
"solo"
"c2"
"fw"
]
);
colmenaHive = colmena.lib.makeHive { colmenaHive = colmena.lib.makeHive {
meta = { meta = {
@ -99,10 +123,22 @@
targetHost = "185.163.117.158"; targetHost = "185.163.117.158";
buildOnTarget = true; buildOnTarget = true;
}; };
imports = [ imports = [ nixosModules."roam" ];
./host/roam };
./mod "solo" = {
]; deployment.targetHost = null;
deployment.allowLocalDeployment = true;
imports = [ nixosModules."solo" ];
};
"c2" = {
deployment.targetHost = null;
deployment.allowLocalDeployment = true;
imports = [ nixosModules."c2" ];
};
"fw" = {
deployment.targetHost = null;
deployment.allowLocalDeployment = true;
imports = [ nixosModules."fw" ];
}; };
}; };
} }

View file

@ -32,7 +32,7 @@ in
wg-quick = { wg-quick = {
interfaces = { interfaces = {
"onet" = { "onet" = {
address = var.wg.wireguard-network.${host}.ips; address = var.wg.wireguard-network.${config.networking.hostName}.ips;
privateKeyFile = var.wg.keyFile; privateKeyFile = var.wg.keyFile;
peers = [ (lib.removeAttrs var.wg.wireguard-network."roam" [ "ips" ]) ]; peers = [ (lib.removeAttrs var.wg.wireguard-network."roam" [ "ips" ]) ];
mtu = 1248; mtu = 1248;