jellyfin-web: use buildNpmPackage

This commit is contained in:
Johannes Schleifenbaum 2023-05-07 10:40:00 +02:00
parent c5973e7f6e
commit 8708d52e31
No known key found for this signature in database
GPG Key ID: 059093B1A278BCD0
4 changed files with 7 additions and 14399 deletions

View File

@ -1,17 +0,0 @@
# 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;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
#!/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

View File

@ -1,11 +1,11 @@
{ 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;
};
}