diff --git a/nixos/modules/services/misc/jellyseerr.nix b/nixos/modules/services/misc/jellyseerr.nix index 09aaf4ed5b97d2..0c4a83abc30095 100644 --- a/nixos/modules/services/misc/jellyseerr.nix +++ b/nixos/modules/services/misc/jellyseerr.nix @@ -20,6 +20,19 @@ in default = 5055; description = ''The port which the Jellyseerr web UI should listen to.''; }; + + dataDir = lib.mkOption { + type = lib.types.path; + default = "/var/lib/jellyseerr"; + description = "Base data directory"; + }; + + configDir = lib.mkOption { + type = lib.types.path; + default = "${cfg.dataDir}/config"; + defaultText = "\${cfg.dataDir}/config"; + description = "Directory containing server configuration files."; + }; }; config = lib.mkIf cfg.enable { @@ -27,14 +40,15 @@ in description = "Jellyseerr, a requests manager for Jellyfin"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; - environment.PORT = toString cfg.port; + environment = { + PORT = toString cfg.port; + CONFIG_DIRECTORY = cfg.configDir; + }; serviceConfig = { Type = "exec"; StateDirectory = "jellyseerr"; - WorkingDirectory = "${cfg.package}/share/dist"; DynamicUser = true; ExecStart = lib.getExe cfg.package; - BindPaths = [ "/var/lib/jellyseerr/:${cfg.package}/share/dist/config/" ]; Restart = "on-failure"; ProtectHome = true; ProtectSystem = "strict"; diff --git a/pkgs/by-name/je/jellyseerr/package.nix b/pkgs/by-name/je/jellyseerr/package.nix index 26502afdc54cfb..4c953d130cf9af 100644 --- a/pkgs/by-name/je/jellyseerr/package.nix +++ b/pkgs/by-name/je/jellyseerr/package.nix @@ -46,13 +46,14 @@ stdenv.mkDerivation rec { runHook preBuild pnpm build pnpm prune --prod --ignore-scripts + rm -rf .next/cache runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/share - cp -r -t $out/share .next node_modules dist config package.json + cp -r -t $out/share .next node_modules dist config package.json overseerr-api.yml runHook postInstall ''; @@ -60,6 +61,7 @@ stdenv.mkDerivation rec { mkdir -p $out/bin makeWrapper '${nodejs}/bin/node' "$out/bin/jellyseerr" \ --add-flags "$out/share/dist/index.js" \ + --chdir "$out/share" \ --set NODE_ENV production '';