48 lines
1.1 KiB
Nix
48 lines
1.1 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
nglib,
|
|
config,
|
|
...
|
|
}: let
|
|
cfg = config.services.prowlarr;
|
|
cfgInit = config.init.services.prowlarr;
|
|
in {
|
|
options.services.prowlarr = {
|
|
enable = lib.mkEnableOption "prowlarr";
|
|
package = lib.mkPackageOption pkgs "prowlarr" {};
|
|
|
|
dataDir = lib.mkOption {
|
|
description = "Directory to store Prowlarr's data";
|
|
type = lib.types.str;
|
|
default = "/config";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
init.services.prowlarr = {
|
|
enabled = true;
|
|
user = lib.mkDefault "prowlarr";
|
|
group = lib.mkDefault "prowlarr";
|
|
|
|
script = pkgs.writeShellScript "prowlarr-run" ''
|
|
${lib.getExe cfg.package} \
|
|
-nobrowser \
|
|
-data=${cfg.dataDir}
|
|
'';
|
|
};
|
|
|
|
environment.systemPackages = [cfg.package];
|
|
|
|
users.users.${cfgInit.user} = nglib.mkDefaultRec {
|
|
description = "prowlarr";
|
|
group = cfgInit.group;
|
|
createHome = false;
|
|
home = "/var/empty";
|
|
useDefaultShell = true;
|
|
uid = config.ids.uids.prowlarr;
|
|
};
|
|
|
|
users.groups.${cfgInit.group} = nglib.mkDefaultRec {gid = config.ids.gids.prowlarr;};
|
|
};
|
|
}
|