unpackerr service

This commit is contained in:
death916 2025-09-16 03:41:34 -07:00
parent 9040dfba3f
commit 5f4e1ffd2b

View file

@ -10,21 +10,17 @@ with lib;
let let
cfg = config.arrSuite; cfg = config.arrSuite;
unpackerrCfg = cfg.unpackerr;
in in
{ {
options.arrSuite = { options.arrSuite = {
enable = mkEnableOption "Enable Sonarr, Radarr, Readarr, and Prowlarr suite"; enable = mkEnableOption "Enable Sonarr, Radarr, Readarr, and Prowlarr suite";
unpackerr = { unpackerr = {
enable = mkEnableOption "Enable Unpackerr service"; enable = mkEnableOption "Enable Unpackerr service";
downloadPath = mkOption { configFile = mkOption {
type = types.str; type = types.path;
default = "/media/storage/media/downloads"; default = "/etc/unpackerr/unpackerr.conf";
description = "Path to the download directory to watch."; description = "Path to the unpackerr.conf file.";
};
extractPath = mkOption {
type = types.str;
default = "";
description = "Path to extract files to. Leave empty to extract in place.";
}; };
}; };
}; };
@ -92,7 +88,7 @@ in
group = "media_services"; group = "media_services";
}; };
systemd.services.unpackerr = mkIf cfg.unpackerr.enable { systemd.services.unpackerr = mkIf unpackerrCfg.enable {
description = "Unpackerr Service"; description = "Unpackerr Service";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@ -100,19 +96,7 @@ in
Type = "simple"; Type = "simple";
User = "unpackerr"; User = "unpackerr";
Group = "media_services"; Group = "media_services";
ExecStart = '' ExecStart = "${pkgs.unpackerr}/bin/unpackerr --config ${unpackerrCfg.configFile}";
${pkgs.unpackerr}/bin/unpackerr --config ${
pkgs.writeText "unpackerr.conf" ''
[unpackerr]
log_file = "/var/log/unpackerr.log"
log_files = 10
log_file_mb = 10
[[folder]]
path = "${cfg.unpackerr.downloadPath}"
extract_path = "${cfg.unpackerr.extractPath}"
''
}
'';
}; };
}; };
}; };