services: add sabnzbd

Its configuration isn't declarative :-(.

Notably, the port needs to be changed from '8080' to '9090' in its
configuration file (at '/var/lib/sabnzbd/').
This commit is contained in:
Bruno BELANYI 2021-02-01 16:25:34 +01:00
parent 89db21792c
commit 6038d0df60
4 changed files with 32 additions and 1 deletions

View file

@ -80,6 +80,8 @@
matrix.enable = true;
# The whole *arr software suite
pirate.enable = true;
# Usenet client
sabnzbd.enable = true;
# Torrent client and webui
transmission = {
enable = true;

View file

@ -8,6 +8,7 @@
./media.nix
./nginx.nix
./pirate.nix
./sabnzbd.nix
./transmission.nix
];
}

View file

@ -3,7 +3,7 @@
{ config, lib, ... }:
let
needed = with config.my.services;
jellyfin.enable || pirate.enable || transmission.enable;
jellyfin.enable || pirate.enable || sabnzbd.enable || transmission.enable;
in
{
config.users.groups.media = lib.mkIf needed { };

28
services/sabnzbd.nix Normal file
View file

@ -0,0 +1,28 @@
# Usenet binary client.
{ config, lib, ... }:
let
cfg = config.my.services.sabnzbd;
domain = config.networking.domain;
sabnzbdDomain = "sabnzbd.${domain}";
port = 9090; # NOTE: not declaratively set...
in
{
options.my.services.sabnzbd = with lib; {
enable = mkEnableOption "SABnzbd binary news reader";
};
config = lib.mkIf cfg.enable {
services.sabnzbd = {
enable = true;
group = "media";
};
services.nginx.virtualHosts."${sabnzbdDomain}" = {
forceSSL = true;
useACMEHost = domain;
locations."/".proxyPass = "http://localhost:${toString port}";
};
};
}