pds/pdsadmin: 0.4.67 -> 0.4.74

This commit is contained in:
Erwin Boskma 2024-12-19 22:54:57 +01:00
parent 5c3d222de9
commit 7574ca53e6
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg
2 changed files with 47 additions and 18 deletions

View file

@ -1,10 +1,16 @@
{ {
stdenv,
makeBinaryWrapper,
removeReferencesTo,
srcOnly,
python3,
pnpm,
fetchFromGitHub, fetchFromGitHub,
nodejs, nodejs,
buildNpmPackage,
vips, vips,
pkg-config, pkg-config,
writeShellApplication, writeShellApplication,
bash,
xxd, xxd,
openssl, openssl,
nixosTests, nixosTests,
@ -27,38 +33,59 @@ let
echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32)" echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32)"
''; '';
}; };
nodeSources = srcOnly nodejs;
customPython3 = python3.withPackages (p: [ p.setuptools ]);
in in
# NOTE: Package comes with `pnpm-lock.yaml` but we cannot use `pnpm.fetchDeps` here because it stdenv.mkDerivation (finalAttrs: {
# does not work with `sharp` NPM dependency that needs `vips` and `pkg-config`
# Regenerate `package-lock.json` with `npm i --package-lock-only`
# Next release should have bumped `sharp` with pre-built binaries
buildNpmPackage rec {
pname = "pds"; pname = "pds";
version = "0.4.67"; version = "0.4.74";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "bluesky-social"; owner = "bluesky-social";
repo = "pds"; repo = "pds";
rev = "v${version}"; rev = "v${finalAttrs.version}";
hash = "sha256-dEB5u++Zx+F4TH5q44AF/tuwAhLEyYT+U5/18viT4sw="; hash = "sha256-kNHsQ6funmo8bnkFBNWHQ0Fmd5nf/uh+x9buaRJMZnM=";
}; };
sourceRoot = "${src.name}/service"; sourceRoot = "${finalAttrs.src.name}/service";
npmDepsHash = "sha256-uQKhODaVHLj+JEq6LYiJ/zXuu7kDCLmpxOs/VCc0GqQ="; npmDepsHash = "sha256-uQKhODaVHLj+JEq6LYiJ/zXuu7kDCLmpxOs/VCc0GqQ=";
postPatch = '' nativeBuildInputs = [
cp ${./package-lock.json} package-lock.json makeBinaryWrapper
''; nodejs
customPython3
pkg-config
pnpm.configHook
];
# Required for `sharp` NPM dependency # Required for `sharp` NPM dependency
nativeBuildInputs = [ pkg-config ];
buildInputs = [ vips ]; buildInputs = [ vips ];
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs)
pname
version
src
sourceRoot
;
hash = "sha256-oU4dwlBdsMmgAUv1ICaOqaqucmg/TjKOZxjnxpm0qL8=";
};
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
for f in $(find -path '*/node_modules/better-sqlite3' -type d); do
(cd "$f" && (
npm run build-release --offline --nodedir=${nodeSources}
find build -type f -exec \
${lib.getExe removeReferencesTo} \
-t "${nodeSources}" {} \;
))
done
makeWrapper "${lib.getExe nodejs}" "$out/bin/pds" \ makeWrapper "${lib.getExe nodejs}" "$out/bin/pds" \
--add-flags --enable-source-maps \ --add-flags --enable-source-maps \
--add-flags "$out/lib/pds/index.js" \ --add-flags "$out/lib/pds/index.js" \
@ -95,4 +122,4 @@ buildNpmPackage rec {
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
mainProgram = "pds"; mainProgram = "pds";
}; };
} })

View file

@ -15,13 +15,15 @@ stdenvNoCC.mkDerivation (finalAttrs: {
patches = [ ./pdsadmin-offline.patch ]; patches = [ ./pdsadmin-offline.patch ];
nativeBuildInputs = [
makeBinaryWrapper
];
buildInputs = [ buildInputs = [
bash bash
]; ];
nativeBuildInputs = [ strictDeps = true;
makeBinaryWrapper
];
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild