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
+4
View File
@@ -7,6 +7,7 @@
git git
nix nix
openssh openssh
dnscontrol
]; ];
serviceConfig = { serviceConfig = {
@@ -48,6 +49,9 @@
exit 1 exit 1
fi fi
echo "Applying DNS configuration..."
dnscontrol push --config dns/dnscontrol.js --creds dns/creds.json
echo "Auto-update completed successfully" echo "Auto-update completed successfully"
''; '';
}; };
+5 -1
View File
@@ -67,7 +67,11 @@
}; };
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config = {
allowUnfree = true;
# PDS v0.4.219 uses a pnpm 9 lockfile; pnpm is build-only here.
permittedInsecurePackages = [ "pnpm-9.15.9" ];
};
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
+32 -2
View File
@@ -31,6 +31,36 @@ final: prev: {
}; };
sourceRoot = "${src.name}/service"; 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 # 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 # may have changed. The hash below was computed by running a build with
@@ -39,8 +69,8 @@ final: prev: {
pname = "pds"; pname = "pds";
inherit version src sourceRoot; inherit version src sourceRoot;
pnpm = prev.pnpm_9; pnpm = prev.pnpm_9;
fetcherVersion = 2; fetcherVersion = 3;
hash = "sha256-n7UurqgR15vu1yNRXCWTWpEU42xgqVVaKurIMvt3XYk="; hash = "sha256-rZpimxX4oDXIaUdAkkNPEff6qYJ9C8KptsPWJKwPiFo=";
}; };
}); });
} }