Update services/sabnzbd.nix

This commit is contained in:
rope 2026-05-04 02:29:10 -07:00
parent e77ca8fceb
commit dda93320d8

View file

@ -3,10 +3,12 @@ let
patchConfig = pkgs.writeShellScript "sabnzbd-patch-config" ''
CONFIG=/var/lib/sabnzbd/sabnzbd.ini
HOSTNAME=sabnzbd.nordhammer.it
if [ ! -f "$CONFIG" ]; then
printf '[misc]\nhost_whitelist = %s\nport = 8085\n' "$HOSTNAME" > "$CONFIG"
exit 0
fi
${pkgs.python3}/bin/python3 - <<'EOF'
import configparser, os, sys
config_file = '/var/lib/sabnzbd/sabnzbd.ini'
@ -27,10 +29,12 @@ EOF
in
{
config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") {
users.users.sabnzbd = {
isSystemUser = true;
group = "media";
};
systemd.tmpfiles.rules = [
"d /var/lib/sabnzbd 0755 sabnzbd media -"
"Z /var/lib/sabnzbd 0755 sabnzbd media -"
@ -39,6 +43,7 @@ in
"d /mnt/storage/usenet/incomplete 2775 sabnzbd media -"
"Z /mnt/storage/usenet/incomplete 2775 sabnzbd media -"
];
systemd.services.sabnzbd = {
description = "SABnzbd usenet downloader";
after = [ "network.target" ];