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
./guests/common.nix
({config, ...}: {node.secretsDir = ./secrets + "/${config.node.name}";})
({config, ...}: {node.secretsDir = ./secrets + "/${config.node.guestName}";})
mainModule
];
};

View file

@ -56,6 +56,6 @@
# TODO See https://github.com/ryantm/agenix/pull/187.
system.activationScripts = lib.mkIf (config.age.secrets != {}) {
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;
in {
node.guestName = guestName;
node.name = guestCfg.nodeName;
node.type = guestCfg.backend;

View file

@ -97,12 +97,19 @@ in {
}
];
options.node.type = mkOption {
options.node = {
type = mkOption {
type = types.enum ["host" "microvm" "container"];
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 {
type = types.attrsOf (types.submodule (submod: {
options.nixosConfiguration = mkOption {