mirror of
https://github.com/Death916/nixconfig.git
synced 2026-04-11 04:48:25 -07:00
unpackerr service
This commit is contained in:
parent
c499998356
commit
9040dfba3f
2 changed files with 45 additions and 2 deletions
|
|
@ -6,12 +6,30 @@
|
|||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.arrSuite;
|
||||
in
|
||||
{
|
||||
options.arrSuite = {
|
||||
enable = lib.mkEnableOption "Enable Sonarr, Radarr, Readarr, and Prowlarr suite";
|
||||
enable = mkEnableOption "Enable Sonarr, Radarr, Readarr, and Prowlarr suite";
|
||||
unpackerr = {
|
||||
enable = mkEnableOption "Enable Unpackerr service";
|
||||
downloadPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/media/storage/media/downloads";
|
||||
description = "Path to the download directory to watch.";
|
||||
};
|
||||
extractPath = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Path to extract files to. Leave empty to extract in place.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.arrSuite.enable {
|
||||
config = mkIf cfg.enable {
|
||||
# Define a common group for media services
|
||||
users.groups.media_services = { };
|
||||
|
||||
|
|
@ -73,5 +91,29 @@
|
|||
isSystemUser = true;
|
||||
group = "media_services";
|
||||
};
|
||||
|
||||
systemd.services.unpackerr = mkIf cfg.unpackerr.enable {
|
||||
description = "Unpackerr Service";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "unpackerr";
|
||||
Group = "media_services";
|
||||
ExecStart = ''
|
||||
${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}"
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue