2023-04-15 19:40:53 +00:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
services.sabnzbd = {
|
|
|
|
enable = true;
|
|
|
|
user = "media_user";
|
|
|
|
group = "media_group";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.sabnzbd = {
|
|
|
|
bindsTo = [ "wg.service" ];
|
|
|
|
after = lib.mkForce [ "wg.service" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
NetworkNamespacePath = "/var/run/netns/wg";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.socat-sabnzbd = {
|
|
|
|
description = "socat exposes sabnzbd";
|
|
|
|
bindsTo = [ "wg.service" ];
|
2023-04-15 20:26:41 +00:00
|
|
|
requires = [ "sabnzbd.service" ];
|
2023-04-15 19:40:53 +00:00
|
|
|
after = [ "wg.service" ];
|
2023-04-15 22:39:50 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2023-04-15 19:40:53 +00:00
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
RuntimeDirectory = "socat-sabnzbd";
|
|
|
|
DynamicUser = true;
|
|
|
|
UMask = "000";
|
|
|
|
NetworkNamespacePath = "/var/run/netns/wg";
|
|
|
|
ExecStart = "${pkgs.socat}/bin/socat -d -d UNIX-LISTEN:/run/socat-sabnzbd/sabnzbd.sock,unlink-early,fork TCP4:127.0.0.1:8080";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
proxyPass = "http://unix:/run/socat-sabnzbd/sabnzbd.sock:/";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|