kubernetes-deployments/nixng-modules/prowlarr.nix
Pim Kunis abb7a131bc Package Deluge with NixNG
Use same group for all media images
2025-01-05 23:08:24 +01:00

48 lines
1.2 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} = lib.mkIf (cfgInit.user == "prowlarr") (nglib.mkDefaultRec {
description = "prowlarr";
group = cfgInit.group;
createHome = false;
home = "/var/empty";
useDefaultShell = true;
uid = config.ids.uids.prowlarr;
});
users.groups.${cfgInit.group} = lib.mkIf (cfgInit.group == "prowlarr") (nglib.mkDefaultRec {gid = config.ids.gids.prowlarr;});
};
}