mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-06 21:17:14 -06:00
test: trying to get microVMs to work
This commit is contained in:
parent
5fc49f405a
commit
72bb3fbe34
11 changed files with 350 additions and 167 deletions
|
|
@ -286,7 +286,7 @@ in
|
||||||
varPath = var;
|
varPath = var;
|
||||||
sslPath = "${var}/acme";
|
sslPath = "${var}/acme";
|
||||||
sopsPath = "${var}/secrets";
|
sopsPath = "${var}/secrets";
|
||||||
secretPath = "${var}/secrets";
|
secretPath = "/run/secrets";
|
||||||
cachePath = "/var/cache";
|
cachePath = "/var/cache";
|
||||||
dummy = "";
|
dummy = "";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,25 @@
|
||||||
let
|
let
|
||||||
inherit (moduleFunctions.instancesFunctions)
|
inherit (moduleFunctions.instancesFunctions)
|
||||||
domain0
|
domain0
|
||||||
servicePath
|
|
||||||
sslPath
|
sslPath
|
||||||
sopsPath
|
varPath
|
||||||
|
mntPath
|
||||||
|
secretPath
|
||||||
|
cachePath
|
||||||
;
|
;
|
||||||
label = "Firefly-III";
|
label = "Firefly-III";
|
||||||
name = "firefly-iii";
|
name = "firefly-iii";
|
||||||
domain = "${subdomain}.${domain0}";
|
|
||||||
subdomain = "finances";
|
subdomain = "finances";
|
||||||
|
domain = "${subdomain}.${domain0}";
|
||||||
|
secrets = "${secretPath}/${name}";
|
||||||
|
ssl = "${sslPath}/${domain}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
label = label;
|
label = label;
|
||||||
name = name;
|
name = name;
|
||||||
short = label;
|
short = label;
|
||||||
email = {
|
email = {
|
||||||
address0 = "noreply@${domain}";
|
address0 = "noreply@${domain0}";
|
||||||
};
|
|
||||||
sops = {
|
|
||||||
path0 = "${sopsPath}/${name}";
|
|
||||||
};
|
};
|
||||||
domains = {
|
domains = {
|
||||||
url0 = domain;
|
url0 = domain;
|
||||||
|
|
@ -30,14 +31,32 @@ in
|
||||||
"money"
|
"money"
|
||||||
];
|
];
|
||||||
subdomain = subdomain;
|
subdomain = subdomain;
|
||||||
paths = {
|
|
||||||
path0 = "${servicePath}/${label}";
|
|
||||||
};
|
|
||||||
ports = {
|
ports = {
|
||||||
port0 = 8080;
|
port0 = 8080;
|
||||||
|
port1 = 8081;
|
||||||
|
};
|
||||||
|
interface = {
|
||||||
|
id = "vm-${name}";
|
||||||
|
mac = "02:00:00:00:54:04";
|
||||||
|
idUser = "vmuser-firefly";
|
||||||
|
macUser = "02:00:00:00:00:04";
|
||||||
|
ip = "192.168.50.114";
|
||||||
|
gate = "192.168.50.1";
|
||||||
|
ssh = 2204;
|
||||||
};
|
};
|
||||||
ssl = {
|
ssl = {
|
||||||
cert = "${sslPath}/${domain}/fullchain.pem";
|
path = ssl;
|
||||||
key = "${sslPath}/${domain}/key.pem";
|
cert = "${ssl}/fullchain.pem";
|
||||||
|
key = "${ssl}/key.pem";
|
||||||
|
};
|
||||||
|
varPaths = {
|
||||||
|
path0 = "${varPath}/${name}";
|
||||||
|
path1 = "${cachePath}/${name}";
|
||||||
|
};
|
||||||
|
mntPaths = {
|
||||||
|
path0 = "${mntPath}/${name}";
|
||||||
|
};
|
||||||
|
secretPaths = {
|
||||||
|
path0 = secrets;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@ in
|
||||||
};
|
};
|
||||||
interface = {
|
interface = {
|
||||||
id = "vm-${name}";
|
id = "vm-${name}";
|
||||||
mac = "02:00:00:00:00:53";
|
mac = "02:00:00:00:53:03";
|
||||||
idUser = "vmuser-${name}";
|
idUser = "vmuser-${name}";
|
||||||
macUser = "02:00:00:00:00:05";
|
macUser = "02:00:00:00:00:03";
|
||||||
ip = "192.168.50.153";
|
ip = "192.168.50.113";
|
||||||
gate = "192.168.50.1";
|
gate = "192.168.50.1";
|
||||||
ssh = 2205;
|
ssh = 2203;
|
||||||
};
|
};
|
||||||
|
|
||||||
ssl = {
|
ssl = {
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,12 @@ in
|
||||||
};
|
};
|
||||||
interface = {
|
interface = {
|
||||||
id = "vm-${name}";
|
id = "vm-${name}";
|
||||||
mac = "02:00:00:00:00:52";
|
mac = "02:00:00:00:52:02";
|
||||||
idUser = "vmuser-${name}";
|
idUser = "vmuser-${name}";
|
||||||
macUser = "03:00:00:00:00:04";
|
macUser = "02:00:00:00:00:02";
|
||||||
ip = "192.168.50.152";
|
ip = "192.168.50.112";
|
||||||
gate = "192.168.50.1";
|
gate = "192.168.50.1";
|
||||||
ssh = 2203;
|
ssh = 2202;
|
||||||
};
|
};
|
||||||
ssl = {
|
ssl = {
|
||||||
path = ssl;
|
path = ssl;
|
||||||
|
|
@ -53,6 +53,7 @@ in
|
||||||
varPaths = {
|
varPaths = {
|
||||||
path0 = "${varPath}/${name}";
|
path0 = "${varPath}/${name}";
|
||||||
path1 = "${cachePath}/${name}";
|
path1 = "${cachePath}/${name}";
|
||||||
|
path2 = "${varPath}/${name}-media";
|
||||||
};
|
};
|
||||||
mntPaths = {
|
mntPaths = {
|
||||||
path0 = "${mntPath}/${name}";
|
path0 = "${mntPath}/${name}";
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ in
|
||||||
};
|
};
|
||||||
interface = {
|
interface = {
|
||||||
id = "vm-${name}";
|
id = "vm-${name}";
|
||||||
mac = "02:00:00:00:00:51";
|
mac = "02:00:00:00:51:01";
|
||||||
idUser = "vmuser-vault";
|
idUser = "vmuser-vault";
|
||||||
macUser = "02:00:00:00:00:03";
|
macUser = "02:00:00:00:00:01";
|
||||||
ip = "192.168.50.151";
|
ip = "192.168.50.111";
|
||||||
gate = "192.168.50.1";
|
gate = "192.168.50.1";
|
||||||
ssh = 2201;
|
ssh = 2201;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ in
|
||||||
caddy
|
caddy
|
||||||
# comfyui
|
# comfyui
|
||||||
# filesorter
|
# filesorter
|
||||||
# firefly-iii
|
firefly-iii
|
||||||
forgejo
|
forgejo
|
||||||
# glance
|
# glance
|
||||||
jellyfin
|
jellyfin
|
||||||
|
|
|
||||||
|
|
@ -1,102 +1,225 @@
|
||||||
{ flake, config, ... }:
|
{
|
||||||
|
config,
|
||||||
|
flake,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
inherit (flake.config.services.instances) firefly-iii smtp;
|
|
||||||
inherit (flake.config.people) user0;
|
inherit (flake.config.people) user0;
|
||||||
inherit (flake.config.people.users.${user0}) email;
|
inherit (flake.config.people.users.${user0}) email;
|
||||||
inherit (flake.config.machines.devices) ceres;
|
inherit (flake.config.services) instances;
|
||||||
host = service.domains.url0;
|
serviceCfg = instances.firefly-iii;
|
||||||
service = firefly-iii;
|
smtpCfg = instances.smtp;
|
||||||
|
hostCfg = instances.web;
|
||||||
|
host = serviceCfg.domains.url0;
|
||||||
|
dns0 = instances.web.dns.provider0;
|
||||||
|
dns0Path = "dns/${dns0}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services = {
|
microvm.vms.${serviceCfg.name} = {
|
||||||
firefly-iii = {
|
autostart = true;
|
||||||
enable = true;
|
restartIfChanged = true;
|
||||||
dataDir = service.paths.path0;
|
config = {
|
||||||
poolConfig = {
|
system.stateVersion = "24.05";
|
||||||
"listen.owner" = config.services.caddy.user;
|
time.timeZone = "America/Winnipeg";
|
||||||
"pm" = "dynamic";
|
users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys;
|
||||||
"pm.max_children" = 32;
|
services = {
|
||||||
"pm.start_servers" = 2;
|
firefly-iii = {
|
||||||
"pm.min_spare_servers" = 2;
|
enable = true;
|
||||||
"pm.max_spare_servers" = 4;
|
dataDir = serviceCfg.varPaths.path0;
|
||||||
"pm.max_requests" = 500;
|
enableNginx = false;
|
||||||
};
|
poolConfig = {
|
||||||
settings = {
|
"listen.owner" = config.services.caddy.user;
|
||||||
DB_CONNECTION = "pgsql";
|
"pm" = "dynamic";
|
||||||
APP_URL = "https://${host}";
|
"pm.max_children" = 32;
|
||||||
APP_KEY_FILE = config.sops.secrets."${service.name}-pass".path;
|
"pm.start_servers" = 2;
|
||||||
DB_PASSWORD_FILE = config.sops.secrets."${service.name}-data".path;
|
"pm.min_spare_servers" = 2;
|
||||||
MAIL_MAILER = smtp.name;
|
"pm.max_spare_servers" = 4;
|
||||||
MAIL_HOST = smtp.hostname;
|
"pm.max_requests" = 500;
|
||||||
MAIL_PORT = smtp.ports.port0;
|
};
|
||||||
MAIL_FROM = smtp.email.address0;
|
settings = {
|
||||||
MAIL_USERNAME = smtp.email.address0;
|
APP_URL = "https://${host}";
|
||||||
MAIL_PASSWORD_FILE = config.sops.secrets."${service.name}-smtp".path;
|
APP_KEY_FILE = "/run/secrets/pass";
|
||||||
MAIL_ENCRYPTION = "tls";
|
DB_PASSWORD_FILE = "/run/secrets/data";
|
||||||
SITE_OWNER = email.address2;
|
DB_CONNECTION = "pgsql";
|
||||||
};
|
DB_HOST = "db";
|
||||||
};
|
DB_DATABASE = "firefly";
|
||||||
firefly-iii-data-importer = {
|
DB_USERNAME = "firefly";
|
||||||
enable = true;
|
MAIL_MAILER = smtpCfg.name;
|
||||||
};
|
MAIL_HOST = smtpCfg.hostname;
|
||||||
caddy = {
|
MAIL_PORT = smtpCfg.ports.port0;
|
||||||
virtualHosts = {
|
MAIL_FROM = smtpCfg.email.address0;
|
||||||
${host} = {
|
MAIL_USERNAME = smtpCfg.email.address0;
|
||||||
extraConfig = ''
|
MAIL_PASSWORD_FILE = "/run/secrets/smtp";
|
||||||
root * ${config.services.firefly-iii.package}/public
|
MAIL_ENCRYPTION = "tls";
|
||||||
file_server
|
SITE_OWNER = email.address2;
|
||||||
encode gzip
|
};
|
||||||
php_fastcgi unix//run/phpfpm/firefly-iii.sock
|
|
||||||
tls ${service.ssl.cert} ${service.ssl.key}
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
firefly-iii-data-importer = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
caddy = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."${serviceCfg.interface.ip}" = {
|
||||||
|
extraConfig = ''
|
||||||
|
root * ${config.services.firefly-iii.package}/public
|
||||||
|
|
||||||
|
file_server
|
||||||
|
|
||||||
|
encode gzip
|
||||||
|
|
||||||
|
php_fastcgi unix//run/phpfpm/firefly-iii.sock
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = [ "firefly" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "firefly";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
PermitRootLogin = "prohibit-password";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
22
|
||||||
|
80
|
||||||
|
serviceCfg.ports.port0
|
||||||
|
serviceCfg.ports.port1
|
||||||
|
];
|
||||||
|
systemd = {
|
||||||
|
network = {
|
||||||
|
enable = true;
|
||||||
|
networks."20-lan" = {
|
||||||
|
matchConfig.Name = "enp0s5";
|
||||||
|
addresses = [
|
||||||
|
{ Address = "${serviceCfg.interface.ip}/24"; }
|
||||||
|
];
|
||||||
|
routes = [
|
||||||
|
{
|
||||||
|
Destination = "${hostCfg.localhost.address1}/0";
|
||||||
|
Gateway = serviceCfg.interface.gate;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
dns = [
|
||||||
|
"1.1.1.1"
|
||||||
|
"8.8.8.8"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
tmpfiles.rules = [
|
||||||
|
"Z ${serviceCfg.varPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
"Z ${serviceCfg.secretPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
"Z /var/lib/postgresql 755 postgres postgres -"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.systemd-networkd.wantedBy = [ "multi-user.target" ];
|
||||||
|
microvm = {
|
||||||
|
vcpu = 2;
|
||||||
|
mem = 3072;
|
||||||
|
hypervisor = "qemu";
|
||||||
|
interfaces = [
|
||||||
|
{
|
||||||
|
type = "tap";
|
||||||
|
id = serviceCfg.interface.id;
|
||||||
|
mac = serviceCfg.interface.mac;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
type = "user";
|
||||||
|
id = serviceCfg.interface.idUser;
|
||||||
|
mac = serviceCfg.interface.macUser;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
forwardPorts = [
|
||||||
|
{
|
||||||
|
from = "host";
|
||||||
|
host.port = serviceCfg.interface.ssh;
|
||||||
|
guest.port = 22;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
shares = [
|
||||||
|
{
|
||||||
|
mountPoint = "/nix/.ro-store";
|
||||||
|
proto = "virtiofs";
|
||||||
|
source = "/nix/store";
|
||||||
|
tag = "read_only_nix_store";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mountPoint = "/var/lib/${serviceCfg.name}";
|
||||||
|
proto = "virtiofs";
|
||||||
|
source = "${serviceCfg.mntPaths.path0}/data";
|
||||||
|
tag = "${serviceCfg.name}_data";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mountPoint = "/var/lib/postgresql";
|
||||||
|
proto = "virtiofs";
|
||||||
|
source = "${serviceCfg.mntPaths.path0}/database";
|
||||||
|
tag = "${serviceCfg.name}_database";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mountPoint = "/run/secrets";
|
||||||
|
proto = "virtiofs";
|
||||||
|
source = "/var/lib/secrets/${serviceCfg.name}";
|
||||||
|
tag = "host_secrets";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
sops =
|
|
||||||
let
|
|
||||||
sopsPath = secret: {
|
|
||||||
path = "${service.sops.path0}/${service.name}-${secret}";
|
|
||||||
owner = service.name;
|
|
||||||
mode = "600";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
secrets = builtins.listToAttrs (
|
|
||||||
map
|
|
||||||
(secret: {
|
|
||||||
name = "${service.name}-${secret}";
|
|
||||||
value = sopsPath secret;
|
|
||||||
})
|
|
||||||
[
|
|
||||||
"pass"
|
|
||||||
"data"
|
|
||||||
"smtp"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/var/lib/${service.name}" = {
|
users.users.caddy.extraGroups = [ "acme" ];
|
||||||
device = service.paths.path0;
|
|
||||||
fsType = "none";
|
security.acme.certs."${host}" = {
|
||||||
options = [
|
dnsProvider = dns0;
|
||||||
"bind"
|
environmentFile = config.sops.secrets.${dns0Path}.path;
|
||||||
];
|
group = "caddy";
|
||||||
depends = [
|
|
||||||
ceres.storage0.mount
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
|
"d ${serviceCfg.mntPaths.path0} 0751 microvm wheel - -"
|
||||||
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
sops = {
|
||||||
firewall.allowedTCPPorts = [
|
secrets = builtins.listToAttrs (
|
||||||
8080
|
map
|
||||||
8081
|
(secret: {
|
||||||
];
|
name = "${serviceCfg.name}/${secret}";
|
||||||
|
value = {
|
||||||
|
path = "/var/lib/secrets";
|
||||||
|
owner = "root";
|
||||||
|
mode = "600";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
[
|
||||||
|
"pass"
|
||||||
|
"data"
|
||||||
|
"smtp"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
services.caddy.virtualHosts."${host}" = {
|
||||||
|
extraConfig = ''
|
||||||
|
reverse_proxy ${serviceCfg.interface.ip}:80
|
||||||
|
|
||||||
|
tls ${serviceCfg.ssl.cert} ${serviceCfg.ssl.key}
|
||||||
|
|
||||||
|
encode zstd gzip
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,12 @@ in
|
||||||
forgejo = {
|
forgejo = {
|
||||||
enable = true;
|
enable = true;
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
|
database = {
|
||||||
|
type = "postgres";
|
||||||
|
};
|
||||||
secrets = {
|
secrets = {
|
||||||
mailer.PASSWD = "/run/secrets/smtp";
|
mailer.PASSWD = "/run/secrets/smtp";
|
||||||
};
|
database.PASSWD = "/run/secrets/database";
|
||||||
dump = {
|
|
||||||
interval = "5:00";
|
|
||||||
type = "zip";
|
|
||||||
file = "forgejo-backup";
|
|
||||||
enable = true;
|
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
server = {
|
server = {
|
||||||
|
|
@ -49,7 +47,7 @@ in
|
||||||
HTTP_PORT = serviceCfg.ports.port0;
|
HTTP_PORT = serviceCfg.ports.port0;
|
||||||
};
|
};
|
||||||
# If you need to start from scratch, don't forget to turn this off again
|
# If you need to start from scratch, don't forget to turn this off again
|
||||||
service.DISABLE_REGISTRATION = true;
|
service.DISABLE_REGISTRATION = false;
|
||||||
actions = {
|
actions = {
|
||||||
ENABLED = true;
|
ENABLED = true;
|
||||||
DEFAULT_ACTIONS_URL = "github";
|
DEFAULT_ACTIONS_URL = "github";
|
||||||
|
|
@ -77,6 +75,17 @@ in
|
||||||
PermitRootLogin = "prohibit-password";
|
PermitRootLogin = "prohibit-password";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = [ serviceCfg.name ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = serviceCfg.name;
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
|
@ -105,7 +114,7 @@ in
|
||||||
addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
|
addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
|
||||||
routes = [
|
routes = [
|
||||||
{
|
{
|
||||||
Destination = "0.0.0.0/0";
|
Destination = "${hostCfg.localhost.address1}/0";
|
||||||
Gateway = serviceCfg.interface.gate;
|
Gateway = serviceCfg.interface.gate;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -114,10 +123,12 @@ in
|
||||||
"8.8.8.8"
|
"8.8.8.8"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tmpfiles.rules = [
|
tmpfiles.rules = [
|
||||||
"d ${serviceCfg.varPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
"Z ${serviceCfg.varPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
"Z ${serviceCfg.secretPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
"Z /var/lib/postgresql 0755 postgres postgres -"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -156,13 +167,19 @@ in
|
||||||
{
|
{
|
||||||
mountPoint = "/var/lib/${serviceCfg.name}";
|
mountPoint = "/var/lib/${serviceCfg.name}";
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
source = serviceCfg.mntPaths.path0;
|
source = "${serviceCfg.mntPaths.path0}/data";
|
||||||
tag = "${serviceCfg.name}_data";
|
tag = "${serviceCfg.name}_data";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
mountPoint = "/var/lib/postgresql";
|
||||||
|
proto = "virtiofs";
|
||||||
|
source = "${serviceCfg.mntPaths.path0}/database";
|
||||||
|
tag = "${serviceCfg.name}_database";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
mountPoint = "/run/secrets";
|
mountPoint = "/run/secrets";
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
source = "/run/secrets/${serviceCfg.name}";
|
source = "/var/lib/secrets/${serviceCfg.name}";
|
||||||
tag = "host_secrets";
|
tag = "host_secrets";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -171,7 +188,9 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d ${serviceCfg.mntPaths.path0} 0777 root root -"
|
"d ${serviceCfg.mntPaths.path0}/data 0751 microvm wheel - -"
|
||||||
|
"d ${serviceCfg.mntPaths.path0}/database 0751 microvm wheel - -"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
services.caddy.virtualHosts."${host}" = {
|
services.caddy.virtualHosts."${host}" = {
|
||||||
|
|
@ -188,10 +207,12 @@ in
|
||||||
|
|
||||||
sops.secrets = {
|
sops.secrets = {
|
||||||
"${serviceCfg.name}/smtp" = {
|
"${serviceCfg.name}/smtp" = {
|
||||||
|
path = "/var/lib/secrets";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
mode = "0600";
|
mode = "0600";
|
||||||
};
|
};
|
||||||
"${serviceCfg.name}/database" = {
|
"${serviceCfg.name}/database" = {
|
||||||
|
path = "/var/lib/secrets";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
mode = "0600";
|
mode = "0600";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ in
|
||||||
autostart = true;
|
autostart = true;
|
||||||
restartIfChanged = true;
|
restartIfChanged = true;
|
||||||
config = {
|
config = {
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "25.05";
|
||||||
time.timeZone = "America/Winnipeg";
|
time.timeZone = "America/Winnipeg";
|
||||||
users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys;
|
users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys;
|
||||||
services = {
|
services = {
|
||||||
|
|
@ -42,11 +42,20 @@ in
|
||||||
serviceCfg.ports.port2
|
serviceCfg.ports.port2
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# fileSystems."/tmp" = {
|
||||||
|
# device = "tmpfs";
|
||||||
|
# fsType = "tmpfs";
|
||||||
|
# options = [
|
||||||
|
# "size=4G"
|
||||||
|
# "mode=1777"
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
network = {
|
network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
networks."20-lan" = {
|
networks."20-lan" = {
|
||||||
matchConfig.Name = "enp0s5";
|
matchConfig.Name = "enp0s6";
|
||||||
addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
|
addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
|
||||||
routes = [
|
routes = [
|
||||||
{
|
{
|
||||||
|
|
@ -60,13 +69,16 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services.systemd-networkd.wantedBy = [ "multi-user.target" ];
|
|
||||||
tmpfiles.rules = [
|
|
||||||
"d ${serviceCfg.varPaths.path0}/media 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
|
||||||
];
|
|
||||||
|
|
||||||
|
# tmpfiles.rules = [
|
||||||
|
# "Z ${serviceCfg.varPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
# "Z ${serviceCfg.varPaths.path1} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
# "Z ${serviceCfg.varPaths.path2} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
# ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.systemd-networkd.wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
microvm = {
|
microvm = {
|
||||||
vcpu = 6;
|
vcpu = 6;
|
||||||
mem = 8192;
|
mem = 8192;
|
||||||
|
|
@ -100,7 +112,7 @@ in
|
||||||
{
|
{
|
||||||
mountPoint = serviceCfg.varPaths.path0;
|
mountPoint = serviceCfg.varPaths.path0;
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
source = serviceCfg.mntPaths.path0;
|
source = "${serviceCfg.mntPaths.path0}/data";
|
||||||
tag = "${serviceCfg.name}_data";
|
tag = "${serviceCfg.name}_data";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -109,15 +121,12 @@ in
|
||||||
source = "${serviceCfg.mntPaths.path0}/cache";
|
source = "${serviceCfg.mntPaths.path0}/cache";
|
||||||
tag = "${serviceCfg.name}_cache";
|
tag = "${serviceCfg.name}_cache";
|
||||||
}
|
}
|
||||||
];
|
{
|
||||||
};
|
mountPoint = serviceCfg.varPaths.path2;
|
||||||
|
proto = "virtiofs";
|
||||||
fileSystems."/tmp" = {
|
source = "${serviceCfg.mntPaths.path0}/media";
|
||||||
device = "tmpfs";
|
tag = "${serviceCfg.name}_media";
|
||||||
fsType = "tmpfs";
|
}
|
||||||
options = [
|
|
||||||
"size=4G"
|
|
||||||
"mode=1777"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -149,8 +158,9 @@ in
|
||||||
users.users.caddy.extraGroups = [ "acme" ];
|
users.users.caddy.extraGroups = [ "acme" ];
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d ${serviceCfg.mntPaths.path0} 0755 999 999 -"
|
"d ${serviceCfg.mntPaths.path0} 0751 microvm wheel - -"
|
||||||
"d ${serviceCfg.mntPaths.path0}/cache 0755 999 999 -"
|
"d ${serviceCfg.mntPaths.path0}/data 0751 microvm wheel - -"
|
||||||
|
"d ${serviceCfg.mntPaths.path0}/cache 0751 microvm wheel - -"
|
||||||
|
"d ${serviceCfg.mntPaths.path0}/media 0751 microvm wheel - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,24 +77,32 @@ in
|
||||||
serviceCfg.ports.port0
|
serviceCfg.ports.port0
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.network = {
|
systemd = {
|
||||||
enable = true;
|
network = {
|
||||||
networks."20-lan" = {
|
enable = true;
|
||||||
matchConfig.Name = "enp0s5";
|
networks."20-lan" = {
|
||||||
addresses = [
|
matchConfig.Name = "enp0s5";
|
||||||
{ Address = "${serviceCfg.interface.ip}/24"; }
|
addresses = [
|
||||||
];
|
{ Address = "${serviceCfg.interface.ip}/24"; }
|
||||||
routes = [
|
];
|
||||||
{
|
routes = [
|
||||||
Destination = "${hostCfg.localhost.address1}/0";
|
{
|
||||||
Gateway = serviceCfg.interface.gate;
|
Destination = "${hostCfg.localhost.address1}/0";
|
||||||
}
|
Gateway = serviceCfg.interface.gate;
|
||||||
];
|
}
|
||||||
dns = [
|
];
|
||||||
"1.1.1.1"
|
dns = [
|
||||||
"8.8.8.8"
|
"1.1.1.1"
|
||||||
];
|
"8.8.8.8"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tmpfiles.rules = [
|
||||||
|
"Z ${serviceCfg.varPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
"Z ${serviceCfg.secretPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
|
||||||
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.systemd-networkd.wantedBy = [ "multi-user.target" ];
|
systemd.services.systemd-networkd.wantedBy = [ "multi-user.target" ];
|
||||||
|
|
@ -140,7 +148,7 @@ in
|
||||||
{
|
{
|
||||||
mountPoint = "/run/secrets";
|
mountPoint = "/run/secrets";
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
source = "/run/secrets/${serviceCfg.name}";
|
source = "/var/lib/secrets/${serviceCfg.name}";
|
||||||
tag = "host_secrets";
|
tag = "host_secrets";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -171,11 +179,12 @@ in
|
||||||
users.users.caddy.extraGroups = [ "acme" ];
|
users.users.caddy.extraGroups = [ "acme" ];
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d ${serviceCfg.mntPaths.path0} 0777 root root -"
|
"d ${serviceCfg.mntPaths.path0} 0751 microvm wheel - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
sops.secrets = {
|
sops.secrets = {
|
||||||
"${serviceCfg.name}/env" = {
|
"${serviceCfg.name}/env" = {
|
||||||
|
path = "/var/lib/secrets";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
mode = "0600";
|
mode = "0600";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@ caddy:
|
||||||
prompter-auth: ENC[AES256_GCM,data:uEj6gruCfcIRoCQY9eNcOka+PAIIhAlKnI+ehZ88aZo90tINcxZ7ZvKqlTJr4rt5o+EO7rvRJcYH/s8/+piszFyxSa64Rtq5KdAjfHnRm0QM8q/2JIHnZsQC3fPz1S177WPs/c3Eydh4VeVe,iv:ZOru4ABFgIy9DoTlMl3InSf8zM1ERNpbRNLN6vy97Jc=,tag:5v3w7kvFQCEPBjchE8K0cw==,type:str]
|
prompter-auth: ENC[AES256_GCM,data:uEj6gruCfcIRoCQY9eNcOka+PAIIhAlKnI+ehZ88aZo90tINcxZ7ZvKqlTJr4rt5o+EO7rvRJcYH/s8/+piszFyxSa64Rtq5KdAjfHnRm0QM8q/2JIHnZsQC3fPz1S177WPs/c3Eydh4VeVe,iv:ZOru4ABFgIy9DoTlMl3InSf8zM1ERNpbRNLN6vy97Jc=,tag:5v3w7kvFQCEPBjchE8K0cw==,type:str]
|
||||||
comfyui-auth: ENC[AES256_GCM,data:YkHxbW/0zTmnrggXKl2jNO4OnBaepmCwB3ZC6d8MPIKf8snWJzAvTq5+X5ABzziwKaypHRTcS6vuNntxKrrD8DS7hX9DqVCZc5WeFHI6S5VzHh3SprW2MF4E8nm4Hj+VHoKGmRSSOU1cfX3J,iv:v0Pid0BCY2QsMNaahBvJd4WWZD115JDLHlOCQvPiaGU=,tag:gpsAgt052NoOyIa9WqJXyg==,type:str]
|
comfyui-auth: ENC[AES256_GCM,data:YkHxbW/0zTmnrggXKl2jNO4OnBaepmCwB3ZC6d8MPIKf8snWJzAvTq5+X5ABzziwKaypHRTcS6vuNntxKrrD8DS7hX9DqVCZc5WeFHI6S5VzHh3SprW2MF4E8nm4Hj+VHoKGmRSSOU1cfX3J,iv:v0Pid0BCY2QsMNaahBvJd4WWZD115JDLHlOCQvPiaGU=,tag:gpsAgt052NoOyIa9WqJXyg==,type:str]
|
||||||
wifi-home: ENC[AES256_GCM,data:5NYSCUyalDf7gZF7WaRQJCo=,iv:RkVZKsmVEBg5M28DSkBD41673iLM+dqDAAhSwjqejck=,tag:QQ17VSWOnU0bGglZq6455Q==,type:str]
|
wifi-home: ENC[AES256_GCM,data:5NYSCUyalDf7gZF7WaRQJCo=,iv:RkVZKsmVEBg5M28DSkBD41673iLM+dqDAAhSwjqejck=,tag:QQ17VSWOnU0bGglZq6455Q==,type:str]
|
||||||
firefly-iii-pass: ENC[AES256_GCM,data:gy7CuAy2PqKyr/+fHjHuKosj7Mi2cfOop4bLew0vZtH9i6IbTs+3wQb1bk5OMmQgMTbm,iv:R+IK4mEuZMhAz5R+9HyL2zscISc+yrSoipcwMiwNL18=,tag:2GF+O7YKXKgFCUGvbZyQKQ==,type:str]
|
firefly-iii:
|
||||||
firefly-iii-data: ENC[AES256_GCM,data:EY/CNiSrnmUjotIshk4KqJ2P7IMpiXYyBr7NeYcI69k=,iv:bocGJHNLMAfHFjs3/6wwxwYqq0qar/uNrwppK+MQjBg=,tag:2H5TD6bd9PUgN7BWkwNuzA==,type:str]
|
pass: ENC[AES256_GCM,data:e7uOZ284bAmokWolrRq81mEguMovZDd9D/7Sr8BwIR6U1Ea/qPfErPgdUEw6OGdQLmmaHg==,iv:2QyCe7cKpys4CEtnNKOBxRA0jo6u2OFU9xeiKnO4myc=,tag:WKCopzEN8+xmAIvla8hqtQ==,type:str]
|
||||||
firefly-iii-smtp: ENC[AES256_GCM,data:suCsPpd5acpasLLJPcgf9gUQlz4geqm/fNlw5b1+zMo=,iv:63o2Jtrn1T+CSeB9YZ9Zr0873zxgAdBDklwdNuC2bT4=,tag:L4smPSDq/FHMQzS39ege1Q==,type:str]
|
data: ENC[AES256_GCM,data:921LhcRTWVk24eEAQoDMV+RllSP3PbSXCCIDXlQA80Mq,iv:YXEgas77DgdyPTnBZa/ySjcERBIwmdDZJbijeNKNF24=,tag:Wj25wA7tLJ2bZ/faG9DUhg==,type:str]
|
||||||
roundcube-pass: ENC[AES256_GCM,data:vLvNVgiOQKIIoBhFD2if4Ct/1qugwe6i9OG8rB4sv4o=,iv:iJJlzgIocPe3ty67C39MF09FkU+p7hqd+GLnE0PBJAA=,tag:kzPVQP55YwMeYHrrsHFHJQ==,type:str]
|
smtp: ENC[AES256_GCM,data:+e4MiRZ2WOZyWYpMf+By1Eb45ih4TA+svLI2+00yQk82,iv:+52+kJouMwkOSDEaOCA8V80+wT/VzNxgtCkOO68SCdk=,tag:YrtrJAXIhQpsUTEeYvrVwQ==,type:str]
|
||||||
password-user0: ENC[AES256_GCM,data:VKrySmPAKh3UwCQXJS0EnOPPLDrigWtw5g4WMbSGz/VRtbzlQxMIgs42c/8NnHiqr98ifWy7u9c280oo7SrHhQmEOOvxfITQ9A==,iv:toGkVKCjsmtPP5Ukk/q8kPSmJo3FcTAyj2vcIEkHmU0=,tag:Nhucsk1kgx7zDZZQKycKZQ==,type:str]
|
password-user0: ENC[AES256_GCM,data:VKrySmPAKh3UwCQXJS0EnOPPLDrigWtw5g4WMbSGz/VRtbzlQxMIgs42c/8NnHiqr98ifWy7u9c280oo7SrHhQmEOOvxfITQ9A==,iv:toGkVKCjsmtPP5Ukk/q8kPSmJo3FcTAyj2vcIEkHmU0=,tag:Nhucsk1kgx7zDZZQKycKZQ==,type:str]
|
||||||
sops:
|
sops:
|
||||||
age:
|
age:
|
||||||
|
|
@ -61,7 +61,7 @@ sops:
|
||||||
bXBOa1VSakoyaWxpODJEOU11QUZCaUEK8Ch9Ten3DdrPHF1DTH2qei85AlHUOaLD
|
bXBOa1VSakoyaWxpODJEOU11QUZCaUEK8Ch9Ten3DdrPHF1DTH2qei85AlHUOaLD
|
||||||
aNfzakake7ej+MxJYdKEU0bcWofNMKzIlZa2uM10KZSENDP8d8qlig==
|
aNfzakake7ej+MxJYdKEU0bcWofNMKzIlZa2uM10KZSENDP8d8qlig==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2025-11-09T09:28:13Z"
|
lastmodified: "2025-11-10T05:21:40Z"
|
||||||
mac: ENC[AES256_GCM,data:JRE3egK93AnFH+d7MJIZ9a0URE2BV/BJIdfbAWZqdfhicOVYb3zg3iJ2EhLIQ2Nm6UnqZe/t27bveQ222orZ3XmD0K8afS+dakEhGy+TcdBuehUiKQ4WNn8cVmahBWc7cy/WaTY4l9L9YzD5N5v7gJgpPknMpdr6qyyzf+i1vj8=,iv:BVunX3YbWzxqPAScme/5RFka7Lyi6gjZ5miSky61kss=,tag:7ont6bHzZuAxHvctsnUN8A==,type:str]
|
mac: ENC[AES256_GCM,data:1e2wUXNJSCP5108HqTnaEalBrDgGI60CgsLrc/ZWE52OpUxOkzfhXZDb1MZWkPEUbmc3ZeJazF9SHBHspYqnO/wznisEzLAPpGMLJePqSPla6pg81UqZdVawwtqoopurCmtr/SHpdQfGcHk9pR5n7tDdwat7xIEPoOStyZUpoDE=,iv:wg9XTEIr4ozhqr4mQP5auG+DZls1towlDAJSGXb08SI=,tag:PUDxUZfTYqy+FMGd6sLy3g==,type:str]
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
version: 3.11.0
|
version: 3.11.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue