ente-web: update and fix build on new versions (#542267)

This commit is contained in:
Sandro
2026-07-18 19:39:25 +00:00
committed by GitHub
2 changed files with 37 additions and 20 deletions
+18 -20
View File
@@ -1,18 +1,15 @@
{
lib,
stdenv,
buildNpmPackage,
binaryen,
cargo,
fetchFromGitHub,
fetchYarnDeps,
nodejs,
rustPlatform,
rustc,
sd,
wasm-bindgen-cli_0_2_108,
wasm-bindgen-cli_0_2_125,
wasm-pack,
yarnConfigHook,
yarnBuildHook,
writeScript,
extraBuildEnv ? { },
# This package contains serveral sub-applications. This specifies which of them you want to build.
@@ -25,9 +22,9 @@
nixosTests,
}:
stdenv.mkDerivation (finalAttrs: {
buildNpmPackage (finalAttrs: {
pname = "ente-web-${enteApp}";
version = "1.3.36";
version = "1.3.58";
src = fetchFromGitHub {
owner = "ente";
@@ -38,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: {
];
tag = "photos-v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-o75r8LFgG3BT3IIPiD9x6gY3fRDoxJ3ZTBPAYr3hLWI=";
hash = "sha256-44iid/vsx3rKt/NGCgdZweJHW24ysQ7qSRq8Hayng9c=";
};
sourceRoot = "${finalAttrs.src.name}/web";
@@ -50,25 +47,20 @@ stdenv.mkDerivation (finalAttrs: {
sourceRoot
cargoRoot
;
hash = "sha256-NYPxaVYEaJVcsRX6wLVJd+/UUJrNel0zTPYGdEv8a+U=";
hash = "sha256-dyDNhDNbcssV4mTzGZkysTftgFfKXNLX2S0jmkX5JR4=";
};
cargoRoot = "packages/wasm";
cargoRoot = "../rust";
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/web/yarn.lock";
hash = "sha256-eGu+s8g0nGijYfjo8RkT5/iBfbwk5cBMacbe/gO03NI=";
};
npmDepsHash = "sha256-JZnF6MfEkm4HCslEgpAuCrSYQYnt8tNPUTFRb1CIVe4=";
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
binaryen
cargo
rustPlatform.cargoSetupHook
rustc
rustc.llvmPackages.lld
nodejs
wasm-bindgen-cli_0_2_108
wasm-bindgen-cli_0_2_125
wasm-pack
];
@@ -76,9 +68,15 @@ stdenv.mkDerivation (finalAttrs: {
env = extraBuildEnv;
postPatch =
# The Rust workspace lives in `../rust`, outside the `web` sourceRoot, so it
# is not made writable during unpacking. `wasm-pack` needs to create a cargo
# target directory there, so make it writable.
''
chmod -R u+w ../rust
''
# Use our `wasm-pack` binary, rather than the Node version, which is
# just a wrapper that tries to download the actual binary
''
+ ''
substituteInPlace \
packages/wasm/package.json \
--replace-fail "wasm-pack " ${lib.escapeShellArg "${wasm-pack}/bin/wasm-pack "}
@@ -92,7 +90,7 @@ stdenv.mkDerivation (finalAttrs: {
done
'';
yarnBuildScript = "build:${enteApp}";
npmBuildScript = "build:${enteApp}";
installPhase =
let
distName = if enteApp == "payments" then "dist" else "out";
@@ -139,7 +137,7 @@ stdenv.mkDerivation (finalAttrs: {
echo "Updated to version $new_version, checking wasm-bindgen..."
# Fetch Cargo.lock from GitHub instead of cloning repository
cargo_lock_url="https://raw.githubusercontent.com/ente-io/ente/photos-v$new_version/web/packages/wasm/Cargo.lock"
cargo_lock_url="https://raw.githubusercontent.com/ente-io/ente/photos-v$new_version/rust/Cargo.lock"
wasm_bindgen_version=$(curl -s "$cargo_lock_url" | tr -d '\r' | grep -A1 '^name = "wasm-bindgen"$' | grep -oP 'version = "\K[^"]+' | head -n1)
@@ -0,0 +1,19 @@
{
buildWasmBindgenCli,
fetchCrate,
rustPlatform,
}:
buildWasmBindgenCli rec {
src = fetchCrate {
pname = "wasm-bindgen-cli";
version = "0.2.125";
hash = "sha256-zRawtjxMOdTMX+mZaiNR3YYfTiZJhf9qj7kXSSeMxrc=";
};
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
inherit (src) pname version;
hash = "sha256-aZCfgR23Qb0Pn4Mm4ToMtuuRQqSJjXCR9li/VvP5CTM=";
};
}