feat: infinitely expansible microvms

This commit is contained in:
Nick 2025-12-09 03:46:57 -06:00
parent a92229390e
commit 4c767d369f
55 changed files with 1089 additions and 1015 deletions

View file

@ -27,6 +27,18 @@ let
}) (builtins.genList (i: i) numOptions)
);
genOptionsSubmodule =
typeConfig: prefix:
builtins.listToAttrs (
map (i: {
name = "${prefix}${toString i}";
value = lib.mkOption {
type = typeConfig;
default = { };
};
}) (builtins.genList (i: i) numOptions)
);
mkOptionsFromDir =
path:
builtins.listToAttrs (
@ -54,30 +66,49 @@ let
};
};
interfaceConfig = {
domain = stringType;
email = stringType;
ip = stringType;
subdomain = stringType;
wireguard = stringType;
microvm = {
gate = stringType;
id = stringType;
idUser = stringType;
mac = stringType;
macUser = stringType;
num = intType;
ssh = intType;
};
ssl = {
cert = stringType;
key = stringType;
path = stringType;
};
paths = {
mntPaths = genOptions stringType "path";
secretPaths = genOptions stringType "path";
varPaths = genOptions stringType "path";
interfaceConfig = lib.types.submodule {
options = {
domain = stringType;
email = stringType;
ip = stringType;
subdomain = stringType;
wireguard = stringType;
microvm = lib.mkOption {
type = lib.types.submodule {
options = {
gate = stringType;
id = stringType;
idUser = stringType;
mac = stringType;
macUser = stringType;
num = intType;
ip = stringType; # Add this if it's missing
ssh = intType;
port = intType;
};
};
default = { };
};
ssl = lib.mkOption {
type = lib.types.submodule {
options = {
cert = stringType;
key = stringType;
path = stringType;
};
};
default = { };
};
paths = lib.mkOption {
type = lib.types.submodule {
options = {
mntPaths = genOptions stringType "path";
secretPaths = genOptions stringType "path";
varPaths = genOptions stringType "path";
};
};
default = { };
};
};
};
@ -90,7 +121,7 @@ let
dns = genOptions stringType "provider";
ports = genOptions intType "port";
addresses = genOptions stringType "address";
interfaces = genOptions interfaceConfig "interface";
interfaces = genOptionsSubmodule interfaceConfig "interface";
};
};