From 953cacc72c552f570751ed479d90cdd16b569e54 Mon Sep 17 00:00:00 2001 From: Sovran Systems <99053422+naturallaw777@users.noreply.github.com> Date: Mon, 10 Aug 2026 17:15:07 -0500 Subject: [PATCH] Mempool: use preBuild cd instead of postUnpack so npmDeps fetcher finds lock files postUnpack did not run in the npmDeps fixed-output derivation, so prefetch-npm-deps couldn't find package-lock.json. preBuild runs in both the fetcher and main build, ensuring consistent CWD for the lock file lookup. Backend patch moved to prePatch/postPatch so it only applies in the main build. npmDepsHash values remain placeholders (lib.fakeHash). --- packages/mempool/default.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/mempool/default.nix b/packages/mempool/default.nix index 192129c..e7be6de 100644 --- a/packages/mempool/default.nix +++ b/packages/mempool/default.nix @@ -80,10 +80,11 @@ in rec { pname = "mempool-backend"; inherit version src; - # Use postUnpack (not sourceRoot) so the npmDeps fixed-output - # derivation hashes the same unpacked tree as the main build. - postUnpack = '' - cd source/backend + # cd into the backend subdir during unpack so the npmDeps fetcher + # finds package-lock.json at its CWD. This hook runs in both the + # deps fetcher and the main build. + preBuild = '' + cd backend ''; # Placeholder: build once, then replace with the hash from the @@ -96,6 +97,11 @@ in rec { ]; # Apply patches only in the main build, not in the npmDeps fetcher. + # prePatch runs before patchPhase in the main build only. + prePatch = '' + cd backend + ''; + postPatch = '' patch -p1 < ${./0001-allow-disabling-mining-pool-fetching.patch} ''; @@ -148,10 +154,10 @@ in rec { pname = "mempool-frontend"; inherit version src; - # Use postUnpack (not sourceRoot) so the npmDeps fixed-output - # derivation hashes the same unpacked tree as the main build. - postUnpack = '' - cd source/frontend + # cd into the frontend subdir so the npmDeps fetcher finds + # package-lock.json at its CWD. + preBuild = '' + cd frontend ''; # Placeholder: build once, then replace with the hash from the