use custom jellyseerr module

This commit is contained in:
Rohan Datar
2025-01-12 15:48:19 -06:00
parent d775217324
commit 2f5b47b081
2 changed files with 100 additions and 4 deletions
+4 -4
View File
@@ -9,6 +9,10 @@ with lib; let
nixarr = config.nixarr;
defaultPort = 5055;
in {
imports = [
./jellyseerr-module
];
options.nixarr.jellyseerr = {
enable = mkOption {
type = types.bool;
@@ -31,10 +35,6 @@ in {
description = ''
The location of the state directory for the Jellyseerr service.
> **Warning** this option does not work on the latest stable nixpkgs.
> If you are using an old version of nixpkgs, make sure to set the
> `jellyseerr.package` option to use the latest version from nixkpgs-unstable.
> **Warning:** Setting this to any path, where the subpath is not
> owned by root, will fail! For example:
>
@@ -0,0 +1,96 @@
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.util-nixarr.services.jellyseerr;
in {
options = {
util-nixarr.services.prowlarr = {
enable = mkEnableOption "Jellyseerr";
package = mkPackageOption pkgs "jellyseerr" {};
user = mkOption {
type = types.str;
default = "jellyseerr";
description = "User account under which Jellyseerr runs.";
};
group = mkOption {
type = types.str;
default = "jellyseerr";
description = "Group under which Jellyseerr runs.";
};
configDir = mkOption {
type = types.str;
default = "/var/lib/jellyseerr";
description = "The directory where Jellyseerr stores its data files.";
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = "Open ports in the firewall for the Jellyseerr web interface.";
};
};
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules = [
"d '${cfg.configDir}' 0700 ${cfg.user} ${cfg.group} - -"
];
systemd.services.prowlarr = {
description = "Jellyseerr, a requests manager for Jellyfin";
after = ["network.target"];
wantedBy = ["multi-user.target"];
environment = {
PORT = toString cfg.port;
CONFIG_DIRECTORY = cfg.configDir;
};
serviceConfig = {
Type = "exec";
StateDirectory = "jellyseerr";
User = cfg.user;
ExecStart = lib.getExe cfg.package;
Restart = "on-failure";
ProtectHome = true;
ProtectSystem = "strict";
PrivateTmp = true;
PrivateDevices = true;
ProtectHostname = true;
ProtectClock = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectKernelLogs = true;
ProtectControlGroups = true;
NoNewPrivileges = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
RemoveIPC = true;
PrivateMounts = true;
};
};
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [5055];
};
users.users = mkIf (cfg.user == "jellyseerr") {
jellyseerr = {
group = cfg.group;
home = cfg.configDir;
uid = 294;
};
};
users.groups = mkIf (cfg.group == "jellyseerr") {
jellyseerr = {};
};
};
}