diff --git a/nix/pkgs/bsky-pds/default.nix b/nix/pkgs/bsky-pds/default.nix new file mode 100644 index 0000000000..35dc823716 --- /dev/null +++ b/nix/pkgs/bsky-pds/default.nix @@ -0,0 +1,64 @@ +{ 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 + ]; + }; +}) diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 2be7541e95..7ca0e7a23c 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -91,4 +91,5 @@ zigbee2mqtt = pkgs.callPackage ./zigbee2mqtt.nix { }; seaweedfs = pkgs.callPackage ./seaweedfs { }; + bsky-pds = pkgs.callPackage ./bsky-pds { }; } // (import ./heptapod-runner args)