Skip to content

Commit

Permalink
nixos/jellyseerr: add dataDir & configDir options
Browse files Browse the repository at this point in the history
  • Loading branch information
coonce committed Dec 18, 2024
1 parent 232f6fe commit d4e5e68
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 17 additions & 3 deletions nixos/modules/services/misc/jellyseerr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,35 @@ 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 {
systemd.services.jellyseerr = {
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";
Expand Down
4 changes: 3 additions & 1 deletion pkgs/by-name/je/jellyseerr/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,22 @@ 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
'';

postInstall = ''
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
'';

Expand Down

0 comments on commit d4e5e68

Please sign in to comment.