openlist: 4.2.1 -> 4.2.2

(cherry picked from commit c90c46c3cf)
This commit is contained in:
Moraxyc 2026-05-31 13:40:48 +08:00 committed by github-actions[bot]
commit f2edf48a3c
3 changed files with 66 additions and 11 deletions

View file

@ -6,24 +6,24 @@
fetchzip,
nodejs,
openlistPnpm ? pnpm_10,
openlistPnpm ? pnpm_11,
pnpmConfigHook,
pnpm_10,
pnpm_11,
}:
buildNpmPackage (finalAttrs: {
pname = "openlist-frontend";
version = "4.2.1";
version = "4.2.2";
src = fetchFromGitHub {
owner = "OpenListTeam";
repo = "OpenList-Frontend";
tag = "v${finalAttrs.version}";
hash = "sha256-4WSL6j0dANUNlHFkMBb8j/KyNHWDQmLnC1y2FFJiBEI=";
hash = "sha256-RLuAGjiYELy+roip2TtvUXGOw6Vk+GkczT1LSI0Vx+8=";
};
i18n = fetchzip {
url = "https://github.com/OpenListTeam/OpenList-Frontend/releases/download/v${finalAttrs.version}/i18n.tar.gz";
hash = "sha256-VzHNZh0ZA2FncAkyozHeBilN4KKsPqbpMESx4QCppW0=";
hash = "sha256-ZO/ozyRNqh2W4/acQmGHoEMpjpf2jph7Gn/kOlwVSFs=";
stripRoot = false;
};
@ -40,8 +40,8 @@ buildNpmPackage (finalAttrs: {
pnpmDeps = fetchPnpmDeps {
inherit (finalAttrs) pname version src;
pnpm = openlistPnpm;
fetcherVersion = 3;
hash = "sha256-rTDk1p568AKim+ZD00uq1q4XNNMeUFL1rGDBWx2C6DQ=";
fetcherVersion = 4;
hash = "sha256-ujsCuQexnKPNwoJzaWmhu3+4xMkZ0jR04m2exG674dI=";
};
npmConfigHook = pnpmConfigHook;
@ -50,6 +50,13 @@ buildNpmPackage (finalAttrs: {
# Error: getaddrinfo ENOTFOUND localhost
__darwinAllowLocalNetworking = true;
preBuild = ''
rm -rf node_modules/mpegts.js
cp -R ${finalAttrs.passthru.mpegts-js}/lib/node_modules/mpegts.js node_modules/mpegts.js
chmod -R u+w node_modules/mpegts.js
test -f node_modules/mpegts.js/dist/mpegts.js
'';
installPhase = ''
runHook preInstall
@ -59,6 +66,25 @@ buildNpmPackage (finalAttrs: {
runHook postInstall
'';
passthru = {
# OpenList depends on a forked mpegts.js git package whose source does not include the generated dist/
mpegts-js = buildNpmPackage {
pname = "mpegts-js-openlist";
version = "1.8.1-unstable-2026-05-16";
src = fetchFromGitHub {
owner = "OpenListTeam";
repo = "mpegts.js";
rev = "1e51e0f6f918cf08e05dfae9c7bfcf658d6b4ac2";
hash = "sha256-z+S3iSYqrMuxFRGa5JZIfGMyi7IErpnluwZUVLxqz2o=";
};
npmDepsHash = "sha256-UDI0iPK/ouVgpzscGrQXNnVUseLWYmR0W9THpBm4WqA=";
meta.license = lib.licenses.asl20;
};
};
meta = {
description = "Frontend of OpenList";
homepage = "https://github.com/OpenListTeam/OpenList-Frontend";

View file

@ -12,13 +12,13 @@
buildGoModule (finalAttrs: {
pname = "openlist";
version = "4.2.1";
version = "4.2.2";
src = fetchFromGitHub {
owner = "OpenListTeam";
repo = "OpenList";
tag = "v${finalAttrs.version}";
hash = "sha256-9MDcAQh06W6mOhYpFR49bxvTTrIoJnKY9P3WRVWsujI=";
hash = "sha256-MxoF+hpzn/44knjVeaINo4/1T4ia7HG8mm+tbvJEsfQ=";
# populate values that require us to use git. By doing this in postFetch we
# can delete .git afterwards and maintain better reproducibility of the src.
leaveDotGit = true;
@ -34,7 +34,7 @@ buildGoModule (finalAttrs: {
frontend = callPackage ./frontend.nix { };
proxyVendor = true;
vendorHash = "sha256-Ho9zVKdzpGKZ/ftJmidUkMBsN4qfvLa96Fg3ayTfYac=";
vendorHash = "sha256-ScPfry0PtSlABdyG+7egMAndG7D3iz1+ceAAhLQPtkM=";
nativeBuildInputs = [
installShellFiles

View file

@ -18,7 +18,6 @@ writeShellApplication {
];
text = ''
# get old info
oldVersion=$(nix-instantiate --eval --strict -A "openlist.version" | jq -e -r)
get_latest_release() {
@ -27,6 +26,24 @@ writeShellApplication {
-s "https://api.github.com/repos/OpenListTeam/$repo/releases/latest" | jq -r ".tag_name"
}
get_github_commit_date() {
local repo=$1
local rev=$2
curl --fail ''${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \
-s "https://api.github.com/repos/OpenListTeam/$repo/commits/$rev" \
| jq -e -r '.commit.committer.date[0:10]'
}
get_github_package_version_at_rev() {
local repo=$1
local rev=$2
curl --fail ''${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \
-s "https://raw.githubusercontent.com/OpenListTeam/$repo/$rev/package.json" \
| jq -e -r '.version'
}
version=$(get_latest_release "OpenList")
version="''${version#v}"
frontendVersion=$(get_latest_release "OpenList-Frontend")
@ -42,6 +59,18 @@ writeShellApplication {
--source-key=i18n --ignore-same-version \
--file=pkgs/by-name/op/openlist/frontend.nix
frontendLockFile="$(nix-build --no-out-link -A openlist.frontend.src)/pnpm-lock.yaml"
mpegtsRev=$(sed -nE 's/.*github:OpenListTeam\/mpegts\.js#([0-9a-f]{40}).*/\1/p' "$frontendLockFile"| head -n1)
mpegtsBaseVersion=$(get_github_package_version_at_rev "mpegts.js" "$mpegtsRev")
mpegtsDate=$(get_github_commit_date "mpegts.js" "$mpegtsRev")
update-source-version openlist.frontend.mpegts-js "$mpegtsBaseVersion-unstable-$mpegtsDate" \
--rev="$mpegtsRev" \
--file=pkgs/by-name/op/openlist/frontend.nix
nix-update openlist.frontend.mpegts-js \
--version=skip \
--override-filename=pkgs/by-name/op/openlist/frontend.nix
nix-update openlist --version="$version"
'';
}