2023-04-18 14:03:31 +00:00
|
|
|
{ pkgs, ... }:
|
2023-04-15 19:40:53 +00:00
|
|
|
|
|
|
|
{
|
2023-05-20 11:15:01 +00:00
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d /var/lib/sabnzbd 0700 media_user media_group"
|
|
|
|
];
|
|
|
|
|
2023-04-18 14:03:31 +00:00
|
|
|
# The nix-provided options force a sabnzbd-user to a certain degree
|
2023-04-27 22:05:07 +00:00
|
|
|
systemd.services.sabnzbd =
|
|
|
|
let
|
|
|
|
mounts = [ "mnt-downloads.mount" ];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
description = "sabnzbd server";
|
|
|
|
requires = mounts;
|
|
|
|
bindsTo = [ "wg.service" ];
|
|
|
|
after = [ "wg.service" ] ++ mounts;
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2023-04-15 19:40:53 +00:00
|
|
|
|
2023-04-27 22:05:07 +00:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "forking";
|
|
|
|
GuessMainPID = "no";
|
|
|
|
User = "media_user";
|
|
|
|
Group = "media_group";
|
|
|
|
NetworkNamespacePath = "/var/run/netns/wg";
|
|
|
|
BindReadOnlyPaths = [
|
|
|
|
"/etc/netns/wg/resolv.conf:/etc/resolv.conf:norbind"
|
|
|
|
"/etc/netns/wg/nsswitch.conf:/etc/nsswitch.conf:norbind"
|
|
|
|
];
|
|
|
|
ExecStart = "${pkgs.sabnzbd}/bin/sabnzbd -d -f /var/lib/sabnzbd/sabnzbd.ini";
|
|
|
|
};
|
2023-04-15 19:40:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."sabnzbd.internal.kempkens.network" = {
|
|
|
|
quic = true;
|
|
|
|
http3 = true;
|
|
|
|
|
|
|
|
onlySSL = true;
|
|
|
|
useACMEHost = "internal.kempkens.network";
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
client_max_body_size 32m;
|
|
|
|
'';
|
|
|
|
|
|
|
|
locations."/" = {
|
|
|
|
recommendedProxySettings = true;
|
2023-04-18 18:11:34 +00:00
|
|
|
proxyPass = "http://192.168.42.2:8080";
|
2023-04-15 19:40:53 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|