Add nzbget

This commit is contained in:
Pim Kunis 2025-03-23 08:28:59 +01:00
parent c70084a7b6
commit b288654567
11 changed files with 203 additions and 576 deletions

568
flake.lock generated
View file

@ -19,47 +19,6 @@
"url": "https://git.kun.is/pim/blog"
}
},
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat_4",
"nixpkgs": "nixpkgs_4",
"utils": "utils"
},
"locked": {
"lastModified": 1727447169,
"narHash": "sha256-3KyjMPUKHkiWhwR91J1YchF6zb6gvckCAY1jOE+ne0U=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "aa07eb05537d4cd025e2310397a6adcedfe72c76",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"servers",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729712798,
"narHash": "sha256-a+Aakkb+amHw4biOZ0iMo8xYl37uUL48YEXIC5PYJ/8=",
"owner": "nix-community",
"repo": "disko",
"rev": "09a776702b004fdf9c41a024e1299d575ee18a7d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"dns": {
"inputs": {
"flake-utils": "flake-utils",
@ -81,28 +40,6 @@
"type": "github"
}
},
"dns_2": {
"inputs": {
"flake-utils": "flake-utils_5",
"nixpkgs": [
"servers",
"nixpkgs"
]
},
"locked": {
"lastModified": 1726867691,
"narHash": "sha256-IK3r16N9pizf53AipOmrcrcyjVsPJwC4PI5hIqEyKwQ=",
"owner": "kirelagin",
"repo": "dns.nix",
"rev": "a3196708a56dee76186a9415c187473b94e6cbae",
"type": "github"
},
"original": {
"owner": "kirelagin",
"repo": "dns.nix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -151,70 +88,6 @@
"type": "github"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_6": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_7": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@ -236,28 +109,6 @@
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"servers",
"nix-snapshotter",
"nixpkgs"
]
},
"locked": {
"lastModified": 1704152458,
"narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "88a2cd8166694ba0b6cb374700799cec53aef527",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1614513358,
@ -326,39 +177,6 @@
"type": "github"
}
},
"flake-utils_5": {
"locked": {
"lastModified": 1614513358,
"narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5466c5bbece17adaab2d82fae80b46e807611bf3",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"inputs": {
"systems": "systems_8"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flutils": {
"inputs": {
"systems": "systems"
@ -399,30 +217,6 @@
"type": "github"
}
},
"git-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_5",
"gitignore": "gitignore_2",
"nixpkgs": [
"servers",
"nixpkgs-unstable"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1730302582,
"narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@ -444,28 +238,6 @@
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"servers",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"globset": {
"inputs": {
"nixpkgs-lib": [
@ -532,30 +304,6 @@
"type": "github"
}
},
"kubenix_2": {
"inputs": {
"flake-compat": "flake-compat_6",
"nixpkgs": [
"servers",
"nixpkgs-unstable"
],
"systems": "systems_9",
"treefmt": "treefmt_2"
},
"locked": {
"lastModified": 1717788185,
"narHash": "sha256-Uc6QSQqJa2lyv/1W4StwoKrjtq7cFjlKNhdrtanToGo=",
"owner": "pizzapim",
"repo": "kubenix",
"rev": "a9590abe23a2f7577bc3271d90955e9ccc2923fe",
"type": "github"
},
"original": {
"owner": "pizzapim",
"repo": "kubenix",
"type": "github"
}
},
"nginx": {
"flake": false,
"locked": {
@ -632,29 +380,6 @@
"type": "github"
}
},
"nix-snapshotter_2": {
"inputs": {
"flake-compat": "flake-compat_7",
"flake-parts": "flake-parts_2",
"nixpkgs": [
"servers",
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1729627456,
"narHash": "sha256-TCZdXCmnqCPsd3PjLv/LDSKJhTspLliL0DE+c/XP9BY=",
"owner": "pdtpartners",
"repo": "nix-snapshotter",
"rev": "f2957822a3748c91e678657a1cfd009b0440bbfd",
"type": "github"
},
"original": {
"owner": "pdtpartners",
"repo": "nix-snapshotter",
"type": "github"
}
},
"nixhelm": {
"inputs": {
"flake-utils": "flake-utils_3",
@ -701,59 +426,6 @@
"type": "github"
}
},
"nixng_2": {
"inputs": {
"nixpkgs": [
"servers",
"nixpkgs"
]
},
"locked": {
"lastModified": 1726571270,
"narHash": "sha256-LEug48WOL+mmFYtKM57e/oudgjBk2Km5zIP3p27hF8I=",
"owner": "pizzapim",
"repo": "NixNG",
"rev": "9538892da603608f0176d07d33b1265e038c0adf",
"type": "github"
},
"original": {
"owner": "pizzapim",
"ref": "dnsmasq",
"repo": "NixNG",
"type": "github"
}
},
"nixos-facter-modules": {
"locked": {
"lastModified": 1730737399,
"narHash": "sha256-PzJrTMhHb9f46uMxmRD4GjnyVuNqxeyEvxaq7OierUQ=",
"owner": "numtide",
"repo": "nixos-facter-modules",
"rev": "c22b916f629fee6941a2976c62247b0bec68082b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nixos-facter-modules",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1729742320,
"narHash": "sha256-u3Of8xRkN//me8PU+RucKA59/6RNy4B2jcGAF36P4jI=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "e8a2f6d5513fe7b7d15701b2d05404ffdc3b6dda",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1714076141,
@ -786,54 +458,6 @@
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1729357638,
"narHash": "sha256-66RHecx+zohbZwJVEPF7uuwHeqf8rykZTMCTqIrOew4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb8c2cf7ea0dd2e18a52746b2c3a5b0c73b93c22",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1729818716,
"narHash": "sha256-XRfkUsxLzFkMn3Tpstio1gNOIQ+2PZPCKbifJ2IXxlw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "062c4f59744fcffa2e5aa3ef443dc8b4d1674ed6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726871744,
@ -867,38 +491,6 @@
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1702272962,
"narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1735554305,
"narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=",
@ -952,63 +544,7 @@
"nixng": "nixng",
"nixpkgs": "nixpkgs_3",
"nixpkgs-master": "nixpkgs-master",
"servers": "servers",
"treefmt-nix": "treefmt-nix_4"
}
},
"servers": {
"inputs": {
"deploy-rs": "deploy-rs",
"disko": "disko",
"dns": "dns_2",
"flake-utils": "flake-utils_6",
"git-hooks": "git-hooks_2",
"kubenix": "kubenix_2",
"nix-snapshotter": "nix-snapshotter_2",
"nixng": "nixng_2",
"nixos-facter-modules": "nixos-facter-modules",
"nixos-hardware": "nixos-hardware",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix",
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1733068232,
"narHash": "sha256-iZJ/cq07OVk2TQy6UV9JaXgLARQqJedmuPIHTtgVeeo=",
"ref": "refs/heads/master",
"rev": "68b79e086c4cc6b850ba12c60f3a978d18bd41b1",
"revCount": 495,
"type": "git",
"url": "https://git.kun.is/home/nixos-servers"
},
"original": {
"type": "git",
"url": "https://git.kun.is/home/nixos-servers"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"servers",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1729775275,
"narHash": "sha256-J2vtHq9sw1wWm0aTMXpEEAzsVCUMZDTEe5kiBYccpLE=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "78a0e634fc8981d6b564f08b6715c69a755c4c7d",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
@ -1100,50 +636,6 @@
"type": "github"
}
},
"systems_7": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_8": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_9": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
},
"treefmt": {
"inputs": {
"nixpkgs": [
@ -1207,25 +699,7 @@
},
"treefmt-nix_3": {
"inputs": {
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1730025913,
"narHash": "sha256-Y9NtFmP8ciLyRsopcCx1tyoaaStKeq+EndwtGCgww7I=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "bae131e525cc8718da22fbeb8d8c7c43c4ea502a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_4": {
"inputs": {
"nixpkgs": "nixpkgs_6"
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1739829690,
@ -1240,46 +714,6 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt_2": {
"inputs": {
"nixpkgs": [
"servers",
"kubenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688026376,
"narHash": "sha256-qJmkr9BWDpqblk4E9/rCsAEl39y2n4Ycw6KRopvpUcY=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "df3f32b0cc253dfc7009b7317e8f0e7ccd70b1cf",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_7"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -28,11 +28,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
servers = {
url = "git+https://git.kun.is/home/nixos-servers";
inputs.nixpkgs.follows = "nixpkgs";
};
nixng = {
url = "github:pizzapim/NixNG/dinit-fixes";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -1,4 +1,4 @@
{servers, ...}: let
{...}: {
globals = {
images = {
jellyfin = "jellyfin/jellyfin:10.10.6";
@ -33,7 +33,33 @@
hasMedia = "true";
};
};
routerPublicIPv4 = "192.145.57.90";
routerPublicIPv6 = "2a0d:6e00:1a77::1";
bind9Ipv6 = "2a0d:6e00:1a77:30::134";
# Load balancer IPv4
traefikIPv4 = "192.168.30.128";
kmsIPv4 = "192.168.30.129";
inbucketIPv4 = "192.168.30.130";
piholeIPv4 = "192.168.30.131";
gitIPv4 = "192.168.30.132";
transmissionIPv4 = "192.168.30.133";
bind9IPv4 = "192.168.30.134";
dnsmasqIPv4 = "192.168.30.135";
minecraftIPv4 = "192.168.30.136";
jellyseerrIPv4 = "192.168.30.137";
syncthingIPv4 = "192.168.30.138";
longhornIPv4 = "192.168.30.139";
radarrIPv4 = "192.168.30.140";
prowlarrIPv4 = "192.168.30.141";
sonarrIPv4 = "192.168.30.142";
bazarrIPv4 = "192.168.30.143";
paperlessIPv4 = "192.168.30.144";
radicaleIPv4 = "192.168.30.145";
freshrssIPv4 = "192.168.30.146";
immichIPv4 = "192.168.30.147";
nextcloudIPv4 = "192.168.30.148";
nzbgetIPv4 = "192.168.30.149";
};
in {
globals = globals // servers.globals;
}

View file

@ -124,6 +124,7 @@
authentik-redis.storage = "5Gi";
mealie.storage = "3Gi";
music.storage = "70Gi";
nzbget.storage = "150Mi";
};
tailscaleIngresses.tailscale-longhorn = {

View file

@ -16,6 +16,7 @@ in {
prowlarr.enable = (lib.mkEnableOption "prowlarr") // {default = true;};
sonarr.enable = (lib.mkEnableOption "sonarr") // {default = true;};
bazarr.enable = (lib.mkEnableOption "bazarr") // {default = true;};
nzbget.enable = (lib.mkEnableOption "nzbget") // {default = true;};
};
config = lib.mkIf cfg.enable {
@ -184,6 +185,73 @@ in {
};
};
nzbget = lib.mkIf cfg.nzbget.enable {
spec = {
selector.matchLabels = {
app = "media";
component = "nzbget";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "nzbget";
};
spec = {
containers.nzbget = {
image = utils.mkNixNGImage "nzbget";
imagePullPolicy = "IfNotPresent";
stdin = true;
tty = true;
ports.web.containerPort = 6789;
volumeMounts = [
{
name = "config";
mountPath = "/home/nzbget";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "nzbget";
media.hostPath = {
path = "/mnt/longhorn/persistent/media";
type = "Directory";
};
};
affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms = [
{
matchExpressions = [
{
key = "hasMedia";
operator = "In";
values = ["true"];
}
];
}
];
};
};
};
};
jellyseerr = lib.mkIf cfg.jellyseerr.enable {
spec = {
selector.matchLabels = {
@ -642,6 +710,23 @@ in {
};
};
};
nzbget = lib.mkIf cfg.nzbget.enable {
spec = {
type = "LoadBalancer";
loadBalancerIP = globals.nzbgetIPv4;
selector = {
app = "media";
component = "nzbget";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
};
};
persistentVolumeClaims.jellyfin-cache = lib.mkIf cfg.jellyfin.enable {
@ -704,6 +789,11 @@ in {
host = "deluge";
service.name = "deluge";
};
tailscale-nzbget = lib.mkIf cfg.nzbget.enable {
host = "nzbget";
service.name = "nzbget";
};
};
longhorn.persistentVolumeClaim = {
@ -746,6 +836,11 @@ in {
volumeName = "music";
storage = "70Gi";
};
nzbget = lib.mkIf cfg.nzbget.enable {
volumeName = "nzbget";
storage = "150Mi";
};
};
};
};

View file

@ -23,6 +23,7 @@ flake-utils.lib.eachDefaultSystem (system: let
deluge = ./deluge.nix;
mealie = ./mealie.nix;
atuin = ./atuin.nix;
nzbget = ./nzbget.nix;
};
in {
nixngConfigurations = builtins.mapAttrs (name: configFile:
@ -47,6 +48,7 @@ in {
self.nixngModules.deluge
self.nixngModules.mealie
self.nixngModules.atuin
self.nixngModules.nzbget
{
nixpkgs.overlays = [
(_final: _prev: {

View file

@ -0,0 +1,22 @@
{
lib,
nglib,
config,
...
}: {
dinit.enable = true;
init.services.nzbget = {
shutdownOnExit = true;
group = lib.mkForce "media";
};
services.nzbget = {
enable = true;
};
users.groups.media = nglib.mkDefaultRec {
gid = config.ids.gids.media;
members = ["nzbget"];
};
}

View file

@ -10,5 +10,6 @@ _: {
deluge = import ./deluge.nix;
mealie = import ./mealie.nix;
atuin = import ./atuin.nix;
nzbget = import ./nzbget.nix;
};
}

View file

@ -73,7 +73,7 @@ in {
users.users.${cfgInit.user} = lib.mkIf (cfgInit.user == "deluge") (nglib.mkDefaultRec {
description = "deluge";
group = cfgInit.group;
inherit (cfgInit) group;
createHome = true;
home = "/home/deluge";
useDefaultShell = true;

View file

@ -10,6 +10,7 @@
deluge = 414;
mealie = 415;
atuin = 416;
nzbget = 417;
};
gids = {
@ -23,6 +24,7 @@
deluge = 414;
mealie = 415;
atuin = 416;
nzbget = 417;
};
};
}

49
nixng-modules/nzbget.nix Normal file
View file

@ -0,0 +1,49 @@
{
pkgs,
lib,
nglib,
config,
...
}: let
cfg = config.services.nzbget;
cfgInit = config.init.services.nzbget;
stateDir = "/home/nzbget";
configFile = "${stateDir}/nzbget.conf";
in {
options.services.nzbget = {
enable = lib.mkEnableOption "nzbget";
package = lib.mkPackageOption pkgs "nzbget" {};
};
config = lib.mkIf cfg.enable {
init.services.nzbget = {
enabled = true;
user = lib.mkDefault "nzbget";
group = lib.mkDefault "nzbget";
execStartPre = pkgs.writeShellScript "nzbget-pre.sh" ''
if [ ! -f ${configFile} ]; then
${pkgs.coreutils}/bin/install -m 0700 ${cfg.package}/share/nzbget/nzbget.conf ${configFile}
fi
'';
script = pkgs.writeShellScript "nzbget-run.sh" ''
umask 0002
${lib.getExe cfg.package} --server --configfile ${configFile}
'';
};
environment.systemPackages = with pkgs; [cfg.package unrar p7zip];
users.users.${cfgInit.user} = lib.mkIf (cfgInit.user == "nzbget") (nglib.mkDefaultRec {
description = "nzbget";
inherit (cfgInit) group;
createHome = true;
home = "/home/nzbget";
useDefaultShell = true;
uid = config.ids.uids.nzbget;
});
users.groups.${cfgInit.group} = lib.mkIf (cfgInit.group == "nzbget") (nglib.mkDefaultRec {gid = config.ids.gids.nzbget;});
};
}