Unverified Commit f3e61347 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #230474 from jojosch/jellyfin-node-update

jellyfin-web: use buildNpmPackage
parents 1b954520 8708d52e
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
# This file has been generated by node2nix 1.11.1. Do not edit!

{pkgs ? import <nixpkgs> {
    inherit system;
  }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}:

let
  nodeEnv = import ../../development/node-packages/node-env.nix {
    inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
    inherit pkgs nodejs;
    libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
  };
in
import ./node-deps.nix {
  inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
  inherit nodeEnv;
}
+0 −14319

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −29
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts nodePackages.node2nix gnused nix coreutils jq

set -euo pipefail

latestVersion="$(curl -s "https://api.github.com/repos/jellyfin/jellyfin-web/releases?per_page=1" | jq -r ".[0].tag_name" | sed 's/^v//')"
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; jellyfin-web.version or (lib.getVersion jellyfin-web)" | tr -d '"')

if [[ "$currentVersion" == "$latestVersion" ]]; then
  echo "jellyfin-web is up-to-date: $currentVersion"
  exit 0
fi

update-source-version jellyfin-web 0 0000000000000000000000000000000000000000000000000000000000000000
update-source-version jellyfin-web "$latestVersion"

# use patched source
store_src="$(nix-build . -A jellyfin-web.src --no-out-link)"

cd "$(dirname "${BASH_SOURCE[0]}")"

node2nix \
  --nodejs-14 \
  --development \
  --node-env ../../development/node-packages/node-env.nix \
  --output ./node-deps.nix \
  --input "$store_src/package.json" \
  --lock "$store_src/package-lock.json" \
  --composition ./node-composition.nix
+7 −34
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, pkgs
, stdenv
, nodejs
, buildNpmPackage
, nix-update-script
}:

stdenv.mkDerivation rec {
buildNpmPackage rec {
  pname = "jellyfin-web";
  version = "10.8.10";

@@ -13,38 +13,12 @@ stdenv.mkDerivation rec {
    owner = "jellyfin";
    repo = "jellyfin-web";
    rev = "v${version}";
    sha256 = "fJmGiHLwhgd3Ac7ggCbkMu6llob3qN87EpHpCO4K29I=";
    hash = "sha256-fJmGiHLwhgd3Ac7ggCbkMu6llob3qN87EpHpCO4K29I=";
  };

  nativeBuildInputs = [
    nodejs
  ];
  npmDepsHash = "sha256-X8a/pmQGAhoGKhThJ86b50sf0nlsCXGgvLQaxRsmA5Q=";

  buildPhase =
    let
      nodeDependencies = ((import ./node-composition.nix {
        inherit pkgs nodejs;
        inherit (stdenv.hostPlatform) system;
      }).nodeDependencies.override (old: {
        # access to path '/nix/store/...-source' is forbidden in restricted mode
        src = src;

        # dont run the prepare script:
        # Error: Cannot find module '/nix/store/...-node-dependencies-jellyfin-web-.../jellyfin-web/scripts/prepare.js
        # npm run build:production runs the same command
        dontNpmInstall = true;
      }));
    in
    ''
      runHook preBuild

      ln -s ${nodeDependencies}/lib/node_modules ./node_modules
      export PATH="${nodeDependencies}/bin:$PATH"

      npm run build:production

      runHook postBuild
    '';
  npmBuildScript = [ "build:production" ];

  installPhase = ''
    runHook preInstall
@@ -55,13 +29,12 @@ stdenv.mkDerivation rec {
    runHook postInstall
  '';

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

  meta = with lib; {
    description = "Web Client for Jellyfin";
    homepage = "https://jellyfin.org/";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ nyanloutre minijackson purcell jojosch ];
    platforms = nodejs.meta.platforms;
  };
}