test: jellyfin microVM

This commit is contained in:
Nick 2025-11-09 00:28:01 -06:00
parent 89cb74e4b7
commit aedf6e4be4
2 changed files with 20 additions and 11 deletions

View file

@ -43,7 +43,7 @@ in
macUser = "03:00:00:00:00:04"; macUser = "03:00:00:00:00:04";
ip = "192.168.50.152"; ip = "192.168.50.152";
gate = "192.168.50.1"; gate = "192.168.50.1";
ssh = 2202; ssh = 2203;
}; };
ssl = { ssl = {
path = ssl; path = ssl;

View file

@ -13,7 +13,7 @@ let
dns0Path = "dns/${dns0}"; dns0Path = "dns/${dns0}";
in in
{ {
microvm.vms.jellyin = { microvm.vms.jellyfin = {
autostart = true; autostart = true;
restartIfChanged = true; restartIfChanged = true;
config = { config = {
@ -46,12 +46,10 @@ in
enable = true; enable = true;
networks."20-lan" = { networks."20-lan" = {
matchConfig.Name = "enp0s5"; matchConfig.Name = "enp0s5";
addresses = [ addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
{ Address = "${serviceCfg.interface.ip}/24"; }
];
routes = [ routes = [
{ {
Destination = "${hostCfg.localhost.address1}/0"; Destination = "0.0.0.0/0";
Gateway = serviceCfg.interface.gate; Gateway = serviceCfg.interface.gate;
} }
]; ];
@ -68,6 +66,7 @@ in
vcpu = 4; vcpu = 4;
mem = 4096; mem = 4096;
hypervisor = "qemu"; hypervisor = "qemu";
interfaces = [ interfaces = [
{ {
type = "tap"; type = "tap";
@ -110,6 +109,17 @@ in
} }
]; ];
}; };
# Increase tmpfs size for /tmp to satisfy Jellyfin's 2GB requirement
# By default, tmpfs is limited to 50% of RAM, but we need more space
fileSystems."/tmp" = {
device = "tmpfs";
fsType = "tmpfs";
options = [
"size=3G"
"mode=1777"
];
};
}; };
}; };
@ -128,9 +138,6 @@ in
header_up X-Real-IP {remote_host} header_up X-Real-IP {remote_host}
} }
redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
tls ${serviceCfg.ssl.cert} ${serviceCfg.ssl.key} tls ${serviceCfg.ssl.cert} ${serviceCfg.ssl.key}
encode zstd gzip encode zstd gzip
''; '';
@ -142,8 +149,10 @@ in
users.users.caddy.extraGroups = [ "acme" ]; users.users.caddy.extraGroups = [ "acme" ];
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${serviceCfg.mntPaths.path0} 0755 root root -" # Create directories with 777 permissions so the jellyfin user (UID 999) inside the VM can write
"d ${serviceCfg.mntPaths.path0}/cache 0755 root root -" # VirtioFS preserves host permissions, and we can't easily match UIDs between host and guest
"d ${serviceCfg.mntPaths.path0} 0777 root root -"
"d ${serviceCfg.mntPaths.path0}/cache 0777 root root -"
]; ];
} }