1
0
Fork 0

mediaserver: sabnzbd

This commit is contained in:
Daniel Kempkens 2023-04-15 21:40:53 +02:00
parent 6c59365dc7
commit 844a8fdac1
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 52 additions and 0 deletions

View file

@ -21,6 +21,7 @@ in
../nixos/mediaserver-setup.nix ../nixos/mediaserver-setup.nix
../nixos/wireguard-netns.nix ../nixos/wireguard-netns.nix
../nixos/prowlarr.nix ../nixos/prowlarr.nix
../nixos/sabnzbd.nix
]; ];
system.stateVersion = "22.11"; system.stateVersion = "22.11";

51
system/nixos/sabnzbd.nix Normal file
View file

@ -0,0 +1,51 @@
{ 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" ];
after = [ "wg.service" ];
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:/";
};
};
}