1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

feat: finish new container backend

This commit is contained in:
oddlama 2023-12-17 17:26:10 +01:00
parent 9833fd50ce
commit 32ce7fe25d
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
4 changed files with 15 additions and 7 deletions

View file

@ -67,7 +67,7 @@
modules = [ modules = [
../../modules ../../modules
./guests/common.nix ./guests/common.nix
({config, ...}: {node.secretsDir = ./secrets + "/${config.node.name}";}) ({config, ...}: {node.secretsDir = ./secrets + "/${config.node.guestName}";})
mainModule mainModule
]; ];
}; };

View file

@ -56,6 +56,6 @@
# TODO See https://github.com/ryantm/agenix/pull/187. # TODO See https://github.com/ryantm/agenix/pull/187.
system.activationScripts = lib.mkIf (config.age.secrets != {}) { system.activationScripts = lib.mkIf (config.age.secrets != {}) {
removeAgenixLink.text = "[[ ! -L /run/agenix ]] && [[ -d /run/agenix ]] && rm -rf /run/agenix"; removeAgenixLink.text = "[[ ! -L /run/agenix ]] && [[ -d /run/agenix ]] && rm -rf /run/agenix";
activationScripts.agenixNewGeneration.deps = ["removeAgenixLink"]; agenixNewGeneration.deps = ["removeAgenixLink"];
}; };
} }

View file

@ -1,6 +1,7 @@
_guestName: guestCfg: {lib, ...}: let guestName: guestCfg: {lib, ...}: let
inherit (lib) mkForce; inherit (lib) mkForce;
in { in {
node.guestName = guestName;
node.name = guestCfg.nodeName; node.name = guestCfg.nodeName;
node.type = guestCfg.backend; node.type = guestCfg.backend;

View file

@ -97,10 +97,17 @@ in {
} }
]; ];
options.node.type = mkOption { options.node = {
type = types.enum ["host" "microvm" "container"]; type = mkOption {
description = "The type of this machine."; type = types.enum ["host" "microvm" "container"];
default = "host"; description = "The type of this machine.";
default = "host";
};
guestName = mkOption {
type = types.str;
description = "The base name of this machine without the parent's name. Only defined if this is a guest.";
};
}; };
options.containers = mkOption { options.containers = mkOption {