depot/nix/pkgs/bsky-pds/default.nix

64 lines
1.5 KiB
Nix

{ lib, stdenv, nodejs, pnpm, fetchFromGitHub, makeWrapper, vips, pkg-config, python3 }:
stdenv.mkDerivation (finalAttrs: {
pname = "bsky-pds";
version = "0.4.59";
src = fetchFromGitHub {
owner = "bluesky-social";
repo = "pds";
rev = "v${finalAttrs.version}";
hash = "sha256-E4SoaLvDaHqOtZ2yExjyK6Z7Bkah6BsCFJd7cvxSwM4=";
};
buildInputs = [
vips
];
nativeBuildInputs = [
python3
pkg-config
makeWrapper
nodejs
pnpm.configHook
nodejs.pkgs.node-gyp-build
];
sourceRoot = "${finalAttrs.src.name}/service";
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src sourceRoot;
hash = "sha256-puUVL1v372Tko8IlFM+uspuUEJgQuV49+jITTvO4OH0=";
};
env.SHARP_FORCE_GLOBAL_LIBVIPS = 1;
env.npm_config_nodedir = nodejs;
postBuild = ''
pnpm rebuild --reporter=append-only
'';
postInstall = ''
mkdir -p $out/bin $out/lib $out/lib
cp -R . $out/lib/bsky-pds
makeWrapper ${nodejs}/bin/node $out/bin/bsky-pds \
--set-default PDS_PORT 3000 \
--set-default NODE_ENV production \
--add-flags --enable-source-maps \
--add-flags $out/lib/bsky-pds/index.js
#--prefix NODE_PATH ':' $out/lib/node_modules \
'';
meta = {
description = "Bluesky Personal Data Server";
mainProgram = "bsky-pds";
homepage = "https://github.com/bluesky-social/pds";
license = with lib.licenses; [
mit
asl20
];
maintainers = with lib.maintainers; [
lukegb
];
};
})