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";
};
};

View file

@ -33,7 +33,7 @@ in
ssl = "${sslPath}/${domain}";
in
{
domains = domain;
domain = domain;
subdomain = subdomain;
email = "${emailNoReply}@${domain1}";
microvm = {

View file

@ -23,7 +23,7 @@ in
ports = {
port0 = 80;
};
interface = {
interfaces = {
interface0 =
let
subdomain = "social";
@ -32,7 +32,7 @@ in
ssl = "${sslPath}/${domain}";
in
{
domains = domain;
domain = domain;
subdomain = subdomain;
email = "noreply@${domain1}";
microvm = {

View file

@ -61,7 +61,7 @@ in
path0 = "${varPath}/${name}";
};
mntPaths = {
path1 = "${mntPath}/${name}/${world}";
path0 = "${mntPath}/${name}/${world}";
};
secretPaths = {
path0 = "${secretPath}/${name}";

View file

@ -23,7 +23,7 @@ in
port0 = 8088; # Open-WebUI (Ollama Front End)
port1 = 11434; # Ollama API
};
interface = {
interfaces = {
interface0 =
let
domain = "${name}.${domain0}";

View file

@ -23,7 +23,7 @@ in
ports = {
port0 = 9200;
};
interface = {
interfaces = {
interface0 =
let
domain = "${short}.${domain0}";

View file

@ -23,7 +23,7 @@ in
ports = {
port0 = 3030;
};
interface = {
interfaces = {
interface0 =
let
domain = "${short}.${domain0}";

View file

@ -23,7 +23,7 @@ in
ports = {
port0 = 3030;
};
interface = {
interfaces = {
interface0 =
let
domain = "${short}.${domain0}";

View file

@ -24,7 +24,7 @@ in
ports = {
port0 = 8085;
};
interface = {
interfaces = {
interface0 =
let
domain = "${name}.${domain0}";

View file

@ -16,7 +16,7 @@ in
name
"blog"
];
interface = {
interfaces = {
interface0 =
let
ssl = "${sslPath}/${domain1}";

View file

@ -9,8 +9,6 @@ in
{
label = label;
name = name;
sops = {
};
ports = {
port0 = 53;
port1 = 51821;

View file

@ -11,7 +11,7 @@ in
{
label = label;
name = name;
interface = {
interfaces = {
interface0 = {
microvm = {
id = "vm-boonbot";