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,
nodejs,
buildNpmPackage,
vips,
pkg-config,
writeShellApplication,
bash,
xxd,
openssl,
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)"
'';
};
nodeSources = srcOnly nodejs;
customPython3 = python3.withPackages (p: [ p.setuptools ]);
in
# NOTE: Package comes with `pnpm-lock.yaml` but we cannot use `pnpm.fetchDeps` here because it
# 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 {
stdenv.mkDerivation (finalAttrs: {
pname = "pds";
version = "0.4.67";
version = "0.4.74";
src = fetchFromGitHub {
owner = "bluesky-social";
repo = "pds";
rev = "v${version}";
hash = "sha256-dEB5u++Zx+F4TH5q44AF/tuwAhLEyYT+U5/18viT4sw=";
rev = "v${finalAttrs.version}";
hash = "sha256-kNHsQ6funmo8bnkFBNWHQ0Fmd5nf/uh+x9buaRJMZnM=";
};
sourceRoot = "${src.name}/service";
sourceRoot = "${finalAttrs.src.name}/service";
npmDepsHash = "sha256-uQKhODaVHLj+JEq6LYiJ/zXuu7kDCLmpxOs/VCc0GqQ=";
postPatch = ''
cp ${./package-lock.json} package-lock.json
'';
nativeBuildInputs = [
makeBinaryWrapper
nodejs
customPython3
pkg-config
pnpm.configHook
];
# Required for `sharp` NPM dependency
nativeBuildInputs = [ pkg-config ];
buildInputs = [ vips ];
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs)
pname
version
src
sourceRoot
;
hash = "sha256-oU4dwlBdsMmgAUv1ICaOqaqucmg/TjKOZxjnxpm0qL8=";
};
buildPhase = ''
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" \
--add-flags --enable-source-maps \
--add-flags "$out/lib/pds/index.js" \
@ -95,4 +122,4 @@ buildNpmPackage rec {
platforms = lib.platforms.unix;
mainProgram = "pds";
};
}
})

View file

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