Unverified Commit 6decfbae authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

jellyseerr: 1.9.2 -> 2.1.0 (#360844)

* jellyseerr: migrate to by-name

* jellyseerr: 1.9.2 -> 2.1.0

* nixos/jellyseerr: add configDir option

* jellyseerr: pin nodejs_20
parents 0c596693 25569750
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -20,6 +20,12 @@ in
      default = 5055;
      description = ''The port which the Jellyseerr web UI should listen to.'';
    };

    configDir = lib.mkOption {
      type = lib.types.path;
      default = "/var/lib/jellyseerr/config";
      description = "Config data directory";
    };
  };

  config = lib.mkIf cfg.enable {
@@ -27,14 +33,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}/libexec/jellyseerr/deps/jellyseerr";
        DynamicUser = true;
        ExecStart = lib.getExe cfg.package;
        BindPaths = [ "/var/lib/jellyseerr/:${cfg.package}/libexec/jellyseerr/deps/jellyseerr/config/" ];
        Restart = "on-failure";
        ProtectHome = true;
        ProtectSystem = "strict";
+87 −0
Original line number Diff line number Diff line
{
  lib,
  mkYarnPackage,
  pnpm_9,
  fetchFromGitHub,
  fetchYarnDeps,
  stdenv,
  makeWrapper,
  node-pre-gyp,
  nodejs,
  nodejs_20,
  python3,
  sqlite,
  nix-update-script,
}:

mkYarnPackage rec {
let
  nodejs = nodejs_20;
  pnpm = pnpm_9.override { inherit nodejs; };
in
stdenv.mkDerivation rec {
  pname = "jellyseerr";
  version = "1.9.2";
  version = "2.1.0";

  src = fetchFromGitHub {
    owner = "Fallenbagel";
    repo = "jellyseerr";
    rev = "v${version}";
    hash = "sha256-TXe/k/pb7idu7G1wGu6TZksnoFQ5/PN0voVlve3k1UI=";
    hash = "sha256-5kaeqhjUy9Lgx4/uFcGRlAo+ROEOdTWc2m49rq8R8Hs=";
  };

  packageJSON = ./package.json;

  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-2iRxguxEI+YKm8ddhRgZMvfZuUgQmCK5ER4jMCFJQMQ=";
  pnpmDeps = pnpm.fetchDeps {
    inherit pname version src;
    hash = "sha256-xu6DeaBArQmnqEnIgjc1DTZujQebSkjuai9tMHeQWCk=";
  };

  nativeBuildInputs = [
    nodejs
    makeWrapper
  ];
  buildInputs = [ sqlite ];

  # Fixes "SQLite package has not been found installed" at launch
  pkgConfig.sqlite3 = {
  nativeBuildInputs = [
      node-pre-gyp
    python3
      sqlite
    nodejs
    makeWrapper
    pnpm.configHook
  ];
    postInstall = ''
      export CPPFLAGS="-I${nodejs}/include/node"
      node-pre-gyp install --prefer-offline --build-from-source --nodedir=${nodejs}/include/node --sqlite=${sqlite.dev}
      rm -r build-tmp-napi-v6
    '';
  };

  pkgConfig.bcrypt = {
    nativeBuildInputs = [
      node-pre-gyp
      python3
    ];
    postInstall = ''
      export CPPFLAGS="-I${nodejs}/include/node"
      node-pre-gyp install --prefer-offline --build-from-source --nodedir=${nodejs}/include/node
  preBuild = ''
    export npm_config_nodedir=${nodejs}
    pushd node_modules
    pnpm rebuild bcrypt sqlite3
    popd
  '';
  };

  buildPhase = ''
    runHook preBuild
    (
      shopt -s dotglob
      cd deps/jellyseerr
      rm -r config/*
      yarn build
      rm -r .next/cache
    )
    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 public package.json overseerr-api.yml
    runHook postInstall
  '';

  postInstall = ''
    mkdir -p $out/bin
    makeWrapper '${nodejs}/bin/node' "$out/bin/jellyseerr" \
      --add-flags "$out/libexec/jellyseerr/deps/jellyseerr/dist/index.js" \
      --add-flags "$out/share/dist/index.js" \
      --chdir "$out/share" \
      --set NODE_ENV production
  '';

  doDist = false;

  passthru.updateScript = ./update.sh;
  passthru.updateScript = nix-update-script { };

  meta = with lib; {
    description = "Fork of overseerr for jellyfin support";
+0 −247
Original line number Diff line number Diff line
{
  "name": "jellyseerr",
  "version": "1.9.2",
  "private": true,
  "scripts": {
    "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts",
    "build:server": "tsc --project server/tsconfig.json && copyfiles -u 2 server/templates/**/*.{html,pug} dist/templates && tsc-alias -p server/tsconfig.json",
    "build:next": "next build",
    "build": "yarn build:next && yarn build:server",
    "lint": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\" --cache",
    "lintfix": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\" --fix",
    "start": "NODE_ENV=production node dist/index.js",
    "i18n:extract": "extract-messages -l=en -o src/i18n/locale -d en --flat true --overwriteDefault true \"./src/**/!(*.test).{ts,tsx}\"",
    "migration:generate": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:generate -d server/datasource.ts",
    "migration:create": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:create -d server/datasource.ts",
    "migration:run": "ts-node -r tsconfig-paths/register --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:run -d server/datasource.ts",
    "format": "prettier --loglevel warn --write --cache .",
    "format:check": "prettier --check --cache .",
    "typecheck": "yarn typecheck:server && yarn typecheck:client",
    "typecheck:server": "tsc --project server/tsconfig.json --noEmit",
    "typecheck:client": "tsc --noEmit",
    "prepare": "husky install",
    "cypress:open": "cypress open",
    "cypress:prepare": "ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/scripts/prepareTestDb.ts",
    "cypress:build": "yarn build && yarn cypress:prepare"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/fallenbagel/jellyseerr.git"
  },
  "license": "MIT",
  "dependencies": {
    "@formatjs/intl-displaynames": "6.2.6",
    "@formatjs/intl-locale": "3.1.1",
    "@formatjs/intl-pluralrules": "5.1.10",
    "@formatjs/intl-utils": "3.8.4",
    "@headlessui/react": "1.7.12",
    "@heroicons/react": "2.0.16",
    "@supercharge/request-ip": "1.2.0",
    "@svgr/webpack": "6.5.1",
    "@tanem/react-nprogress": "5.0.30",
    "ace-builds": "1.15.2",
    "axios": "1.3.4",
    "axios-rate-limit": "1.3.0",
    "bcrypt": "5.1.0",
    "bowser": "2.11.0",
    "cacheable-lookup": "^7.0.0",
    "connect-typeorm": "1.1.4",
    "cookie-parser": "1.4.6",
    "copy-to-clipboard": "3.3.3",
    "country-flag-icons": "1.5.5",
    "cronstrue": "2.23.0",
    "csurf": "1.11.0",
    "date-fns": "2.29.3",
    "dayjs": "1.11.7",
    "email-templates": "9.0.0",
    "email-validator": "2.0.4",
    "express": "4.18.2",
    "express-openapi-validator": "4.13.8",
    "express-rate-limit": "6.7.0",
    "express-session": "1.17.3",
    "formik": "2.2.9",
    "gravatar-url": "3.1.0",
    "intl": "1.2.5",
    "lodash": "4.17.21",
    "next": "12.3.4",
    "node-cache": "5.1.2",
    "node-gyp": "9.3.1",
    "node-schedule": "2.1.1",
    "nodemailer": "6.9.1",
    "openpgp": "5.7.0",
    "plex-api": "5.3.2",
    "pug": "3.0.2",
    "react": "18.2.0",
    "react-ace": "10.1.0",
    "react-animate-height": "2.1.2",
    "react-aria": "3.23.0",
    "react-dom": "18.2.0",
    "react-intersection-observer": "9.4.3",
    "react-intl": "6.2.10",
    "react-markdown": "8.0.5",
    "react-popper-tooltip": "4.4.2",
    "react-select": "5.7.0",
    "react-spring": "9.7.1",
    "react-tailwindcss-datepicker-sct": "1.3.4",
    "react-toast-notifications": "2.5.1",
    "react-truncate-markup": "5.1.2",
    "react-use-clipboard": "1.0.9",
    "reflect-metadata": "0.1.13",
    "secure-random-password": "0.2.3",
    "semver": "7.3.8",
    "sqlite3": "5.1.4",
    "swagger-ui-express": "4.6.2",
    "swr": "2.0.4",
    "typeorm": "0.3.12",
    "web-push": "3.5.0",
    "winston": "3.8.2",
    "winston-daily-rotate-file": "4.7.1",
    "xml2js": "0.4.23",
    "yamljs": "0.3.0",
    "yup": "0.32.11",
    "zod": "3.20.6"
  },
  "devDependencies": {
    "@babel/cli": "7.21.0",
    "@commitlint/cli": "17.4.4",
    "@commitlint/config-conventional": "17.4.4",
    "@semantic-release/changelog": "6.0.2",
    "@semantic-release/commit-analyzer": "9.0.2",
    "@semantic-release/exec": "6.0.3",
    "@semantic-release/git": "10.0.1",
    "@tailwindcss/aspect-ratio": "0.4.2",
    "@tailwindcss/forms": "0.5.3",
    "@tailwindcss/typography": "0.5.9",
    "@types/bcrypt": "5.0.0",
    "@types/cookie-parser": "1.4.3",
    "@types/country-flag-icons": "1.2.0",
    "@types/csurf": "1.11.2",
    "@types/email-templates": "8.0.4",
    "@types/express": "4.17.17",
    "@types/express-session": "1.17.6",
    "@types/lodash": "4.14.191",
    "@types/node": "17.0.36",
    "@types/node-schedule": "2.1.0",
    "@types/nodemailer": "6.4.7",
    "@types/react": "18.0.28",
    "@types/react-dom": "18.0.11",
    "@types/react-transition-group": "4.4.5",
    "@types/secure-random-password": "0.2.1",
    "@types/semver": "7.3.13",
    "@types/swagger-ui-express": "4.1.3",
    "@types/web-push": "3.3.2",
    "@types/xml2js": "0.4.11",
    "@types/yamljs": "0.2.31",
    "@types/yup": "0.29.14",
    "@typescript-eslint/eslint-plugin": "5.54.0",
    "@typescript-eslint/parser": "5.54.0",
    "autoprefixer": "10.4.13",
    "babel-plugin-react-intl": "8.2.25",
    "babel-plugin-react-intl-auto": "3.3.0",
    "commitizen": "4.3.0",
    "copyfiles": "2.4.1",
    "cy-mobile-commands": "0.3.0",
    "cypress": "12.7.0",
    "cz-conventional-changelog": "3.3.0",
    "eslint": "8.35.0",
    "eslint-config-next": "12.3.4",
    "eslint-config-prettier": "8.6.0",
    "eslint-plugin-formatjs": "4.9.0",
    "eslint-plugin-jsx-a11y": "6.7.1",
    "eslint-plugin-no-relative-import-paths": "1.5.2",
    "eslint-plugin-prettier": "4.2.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "extract-react-intl-messages": "4.1.1",
    "husky": "8.0.3",
    "lint-staged": "13.1.2",
    "nodemon": "2.0.20",
    "postcss": "8.4.21",
    "prettier": "2.8.4",
    "prettier-plugin-organize-imports": "3.2.2",
    "prettier-plugin-tailwindcss": "0.2.3",
    "semantic-release": "19.0.5",
    "semantic-release-docker-buildx": "1.0.1",
    "tailwindcss": "3.2.7",
    "ts-node": "10.9.1",
    "tsc-alias": "1.8.2",
    "tsconfig-paths": "4.1.2",
    "typescript": "4.9.5"
  },
  "resolutions": {
    "sqlite3/node-gyp": "8.4.1",
    "@types/react": "18.0.28",
    "@types/react-dom": "18.0.11",
    "@types/express-session": "1.17.6"
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  },
  "lint-staged": {
    "**/*.{ts,tsx,js}": [
      "prettier --write",
      "eslint"
    ],
    "**/*.{json,md,css}": [
      "prettier --write"
    ]
  },
  "commitlint": {
    "extends": [
      "@commitlint/config-conventional"
    ]
  },
  "release": {
    "plugins": [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      [
        "@semantic-release/changelog",
        {
          "changelogFile": "CHANGELOG.md"
        }
      ],
      "@semantic-release/npm",
      [
        "@semantic-release/git",
        {
          "assets": [
            "package.json",
            "CHANGELOG.md"
          ],
          "message": "chore(release): ${nextRelease.version}"
        }
      ],
      "semantic-release-docker-buildx",
      [
        "@semantic-release/github",
        {
          "addReleases": "bottom"
        }
      ]
    ],
    "branches": [
      "main"
    ],
    "npmPublish": false,
    "publish": [
      {
        "path": "semantic-release-docker-buildx",
        "buildArgs": {
          "COMMIT_TAG": "$GIT_SHA"
        },
        "imageNames": [
          "fallenbagel/jellyseerr"
        ],
        "platforms": [
          "linux/amd64",
          "linux/arm64",
          "linux/arm/v7"
        ]
      },
      "@semantic-release/github"
    ]
  }
}

pkgs/servers/jellyseerr/update.sh

deleted100755 → 0
+0 −16
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts nix prefetch-yarn-deps

set -eu -o pipefail

version=${1:-$(curl -s https://api.github.com/repos/Fallenbagel/jellyseerr/releases/latest | jq --raw-output '.tag_name[1:]')}
update-source-version jellyseerr $version

nix_file=$(nix-instantiate --eval --strict -A "jellyseerr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
nix_dir=$(dirname $nix_file)
cp $(nix-instantiate --eval --expr 'with import ./default.nix { }; "${jellyseerr.src}/package.json"' | sed 's/"//g') $nix_dir

old_yarn_hash=$(nix-instantiate --eval --strict -A "jellyseerr.offlineCache.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
lock_file=$(nix-instantiate --eval --expr 'with import ./default.nix { }; "${jellyseerr.src}/yarn.lock"' | sed 's/"//g')
new_yarn_hash=$(nix hash to-sri --type sha256 $(prefetch-yarn-deps $lock_file))
sed -i "$nix_file" -re "s|\"$old_yarn_hash\"|\"$new_yarn_hash\"|"
+0 −2
Original line number Diff line number Diff line
@@ -2404,8 +2404,6 @@ with pkgs;
  jellyfin-mpv-shim = python3Packages.callPackage ../applications/video/jellyfin-mpv-shim { };
  jellyseerr = callPackage ../servers/jellyseerr { };
  juce = callPackage ../development/misc/juce {
    stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
  };
Loading