diff --git a/hosts/h001/mods/default.nix b/hosts/h001/mods/default.nix index 54795945..e6daafa8 100644 --- a/hosts/h001/mods/default.nix +++ b/hosts/h001/mods/default.nix @@ -9,6 +9,7 @@ ./hardware-transcoding.nix ./monitoring_hub.nix ./pinchflat.nix + ./youtarr.nix ./openwebui.nix ./trilium.nix ./oauth2-proxy.nix diff --git a/hosts/h001/mods/litellm.nix b/hosts/h001/mods/litellm.nix index 5d31eabb..8805a786 100644 --- a/hosts/h001/mods/litellm.nix +++ b/hosts/h001/mods/litellm.nix @@ -172,6 +172,8 @@ in api_base = "http://100.64.0.8:9010/air_prd"; api_key = "na"; drop_params = true; + # TODO try this instead of sanitized name + # additional_drop_params = if [ "messages[*].cacheControl" ]; }; }) # curl -L t.net.joshuabell.xyz:9010/air_prd/models | jq '.data.[].id' diff --git a/hosts/h001/mods/youtarr.nix b/hosts/h001/mods/youtarr.nix new file mode 100644 index 00000000..20976441 --- /dev/null +++ b/hosts/h001/mods/youtarr.nix @@ -0,0 +1,78 @@ +{ + lib, + config, + ... +}: +let + name = "youtarr"; + gid = 187; + uid = 187; + port = 3087; + hostConfigDir = "/var/lib/${name}"; + mediaDir = "/nfs/h002/${name}/media"; +in +{ + config = lib.mkIf config.nixarr.enable { + virtualisation.oci-containers.containers = { + "${name}" = { + image = "dialmaster/youtarr:latest"; + ports = [ + "${toString port}:${toString port}" + ]; + volumes = [ + "${hostConfigDir}:/config" + "${mediaDir}:/downloads" + ]; + environment = { + PUID = toString uid; + PGID = toString gid; + }; + }; + }; + + users = { + groups.${name}.gid = gid; + users.${name} = { + isSystemUser = true; + group = name; + uid = uid; + }; + }; + + systemd.tmpfiles.rules = [ + "d '${hostConfigDir}' 0775 ${name} ${name} - -" + "d '${mediaDir}' 0775 ${name} ${name} - -" + ]; + + # Use Nixarr vpn + systemd.services.podman-youtarr.vpnconfinement = { + enable = true; + vpnnamespace = "wg"; + }; + + vpnNamespaces.wg.portMappings = [ + { + from = port; + to = port; + } + ]; + + services.nginx = { + virtualHosts = { + "${name}" = { + serverName = "h001.net.joshuabell.xyz"; + listen = [ + { + port = port; + addr = "0.0.0.0"; + } + ]; + locations."/" = { + proxyWebsockets = true; + proxyPass = "http://192.168.15.1:${toString port}"; + }; + }; + }; + }; + }; +}