fix PDS auto-update build

This commit is contained in:
Anish Lakhwara
2026-08-15 17:08:56 -07:00
parent 4c3c2a761c
commit 694d8013ed
3 changed files with 41 additions and 3 deletions
+32 -2
View File
@@ -31,6 +31,36 @@ final: prev: {
};
sourceRoot = "${src.name}/service";
patches = [];
nativeBuildInputs =
(builtins.filter (pkg: !(builtins.elem (pkg.pname or "") [ "nodejs" "pnpm" ])) old.nativeBuildInputs)
++ [ prev.nodejs_22 prev.pnpm_9 ];
buildPhase = ''
runHook preBuild
pushd ./node_modules/.pnpm/better-sqlite3@*/node_modules/better-sqlite3
npm run build-release --offline --nodedir="${prev.srcOnly prev.nodejs_22}"
find build -type f -exec remove-references-to -t "${prev.srcOnly prev.nodejs_22}" {} \;
popd
makeWrapper "${prev.nodejs_22}/bin/node" "$out/bin/pds" \
--add-flags --enable-source-maps \
--add-flags "$out/lib/pds/index.js" \
--set-default NODE_ENV production
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib/pds}
mv node_modules $out/lib/pds
mv index.js $out/lib/pds
runHook postInstall
'';
# pnpmDeps must be re-fetched whenever src changes because pnpm-lock.yaml
# may have changed. The hash below was computed by running a build with
@@ -39,8 +69,8 @@ final: prev: {
pname = "pds";
inherit version src sourceRoot;
pnpm = prev.pnpm_9;
fetcherVersion = 2;
hash = "sha256-n7UurqgR15vu1yNRXCWTWpEU42xgqVVaKurIMvt3XYk=";
fetcherVersion = 3;
hash = "sha256-rZpimxX4oDXIaUdAkkNPEff6qYJ9C8KptsPWJKwPiFo=";
};
});
}