Merge master into staging-next

This commit is contained in:
Emily 2024-11-09 12:51:01 +00:00
commit ce788776a5
11150 changed files with 61 additions and 19044 deletions

View File

@ -1,7 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.services.nzbget; cfg = config.services.nzbget;
pkg = pkgs.nzbget;
stateDir = "/var/lib/nzbget"; stateDir = "/var/lib/nzbget";
configFile = "${stateDir}/nzbget.conf"; configFile = "${stateDir}/nzbget.conf";
configOpts = lib.concatStringsSep " " (lib.mapAttrsToList (name: value: "-o ${name}=${lib.escapeShellArg (toStr value)}") cfg.settings); configOpts = lib.concatStringsSep " " (lib.mapAttrsToList (name: value: "-o ${name}=${lib.escapeShellArg (toStr value)}") cfg.settings);
@ -24,6 +23,8 @@ in
services.nzbget = { services.nzbget = {
enable = lib.mkEnableOption "NZBGet, for downloading files from news servers"; enable = lib.mkEnableOption "NZBGet, for downloading files from news servers";
package = lib.mkPackageOption pkgs "nzbget" { };
user = lib.mkOption { user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "nzbget"; default = "nzbget";
@ -64,8 +65,8 @@ in
InfoTarget = "screen"; InfoTarget = "screen";
DetailTarget = "screen"; DetailTarget = "screen";
# required paths # required paths
ConfigTemplate = "${pkg}/share/nzbget/nzbget.conf"; ConfigTemplate = "${cfg.package}/share/nzbget/nzbget.conf";
WebDir = "${pkg}/share/nzbget/webui"; WebDir = "${cfg.package}/share/nzbget/webui";
# nixos handles package updates # nixos handles package updates
UpdateCheck = "none"; UpdateCheck = "none";
}; };
@ -81,7 +82,7 @@ in
preStart = '' preStart = ''
if [ ! -f ${configFile} ]; then if [ ! -f ${configFile} ]; then
${pkgs.coreutils}/bin/install -m 0700 ${pkg}/share/nzbget/nzbget.conf ${configFile} ${pkgs.coreutils}/bin/install -m 0700 ${cfg.package}/share/nzbget/nzbget.conf ${configFile}
fi fi
''; '';
@ -92,8 +93,8 @@ in
Group = cfg.group; Group = cfg.group;
UMask = "0002"; UMask = "0002";
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${pkg}/bin/nzbget --server --configfile ${stateDir}/nzbget.conf ${configOpts}"; ExecStart = "${cfg.package}/bin/nzbget --server --configfile ${stateDir}/nzbget.conf ${configOpts}";
ExecStop = "${pkg}/bin/nzbget --quit"; ExecStop = "${cfg.package}/bin/nzbget --quit";
}; };
}; };

Some files were not shown because too many files have changed in this diff Show More