feat: upgrade pds #36

closed
opened by a.starrysky.fyi targeting main from private/minion/push-skzxlxrvsspp

We want to add some patches to our PDS to enable SSO - and those patches need us to be on a later version. Therefore, let's upgrade!

bluesky-pds is packaged in a rather interesting way

  • The vast majority of the code is in a different repo which is normally fetched with pnpm - we need to twist stuff so that we build it with nix
Changed files
+129 -1
packetmix
npins
packages
bluesky-pds
systems
teal
+13
packetmix/npins/sources.json
··· 52 "url": "https://github.com/beancount/smart_importer/archive/d288eb31c580883491294c5e6c0abb4962f16e79.tar.gz", 53 "hash": "sha256-1hE/2za1grfCeo1UK81dpLL/JkiLgaRYqLtF09mbDHc=" 54 }, 55 "catppuccin": { 56 "type": "Git", 57 "repository": {
··· 52 "url": "https://github.com/beancount/smart_importer/archive/d288eb31c580883491294c5e6c0abb4962f16e79.tar.gz", 53 "hash": "sha256-1hE/2za1grfCeo1UK81dpLL/JkiLgaRYqLtF09mbDHc=" 54 }, 55 + "bluesky-atproto": { 56 + "type": "Git", 57 + "repository": { 58 + "type": "GitHub", 59 + "owner": "bluesky-social", 60 + "repo": "atproto" 61 + }, 62 + "branch": "main", 63 + "submodules": false, 64 + "revision": "d91988fe79030b61b556dd6f16a46f0c3b9d0b44", 65 + "url": "https://github.com/bluesky-social/atproto/archive/d91988fe79030b61b556dd6f16a46f0c3b9d0b44.tar.gz", 66 + "hash": "sha256-KCnhgyWiA6kBlQCIEEPHGYDxgkPn5/WIwxlfeShugG0=" 67 + }, 68 "catppuccin": { 69 "type": "Git", 70 "repository": {
+96
packetmix/packages/bluesky-pds/default.nix
···
··· 1 + # SPDX-FileCopyrightText: 2003-2025 Eelco Dolstra and the Nixpkgs/NixOS contributors 2 + # SPDX-FileCopyrightText: 2025 FreshlyBakedCake 3 + # 4 + # SPDX-License-Identifier: MIT 5 + 6 + { config, ... }: 7 + { 8 + config.packages.bluesky-atproto-pds = { 9 + systems = [ "x86_64-linux" ]; 10 + package = 11 + { 12 + system, 13 + stdenv, 14 + nodejs, 15 + pnpm_9, 16 + lib, 17 + srcOnly, 18 + python3, 19 + ... 20 + }: 21 + let 22 + nodeSources = srcOnly nodejs; 23 + pythonEnv = python3.withPackages (p: [ p.setuptools ]); 24 + in 25 + stdenv.mkDerivation (finalAttrs: { 26 + pname = "bluesky-atproto"; 27 + version = config.inputs.bluesky-atproto.src.revision; 28 + 29 + src = config.inputs.bluesky-atproto.src; 30 + 31 + nativeBuildInputs = [ 32 + nodejs 33 + pnpm_9.configHook 34 + pythonEnv 35 + ]; 36 + 37 + pnpmDeps = pnpm_9.fetchDeps { 38 + inherit (finalAttrs) pname version src; 39 + fetcherVersion = 2; 40 + hash = "sha256-AwwlG9ZjAc0TWavM7pOJE77Owfxw+3xjMjfjpJ9z54I="; 41 + }; 42 + 43 + buildPhase = '' 44 + runHook preBuild 45 + 46 + pnpm build 47 + 48 + # copied from nixpkgs to fix better-sqlite3 missing bindings error: 49 + pushd ./node_modules/.pnpm/better-sqlite3@10.0.0/node_modules/better-sqlite3 50 + npm run build-release --offline --nodedir="${nodeSources}" 51 + find build -type f -exec remove-references-to -t "${nodeSources}" {} \; 52 + popd 53 + 54 + pushd ./node_modules/.pnpm/better-sqlite3@9.6.0/node_modules/better-sqlite3 55 + npm run build-release --offline --nodedir="${nodeSources}" 56 + find build -type f -exec remove-references-to -t "${nodeSources}" {} \; 57 + popd 58 + 59 + runHook postBuild 60 + ''; 61 + 62 + installPhase = '' 63 + runHook preInstall 64 + 65 + mkdir -p $out 66 + 67 + cp -r interop-test-files $out 68 + cp -r node_modules $out 69 + cp -r packages $out 70 + cp -r services $out 71 + 72 + mkdir -p $out/lib/@atproto 73 + ln -s $out/packages/pds $out/lib/@atproto/pds 74 + 75 + runHook postInstall 76 + ''; 77 + }); 78 + }; 79 + config.packages.bluesky-pds = { 80 + systems = [ "x86_64-linux" ]; 81 + package = 82 + { 83 + system, 84 + ... 85 + }: 86 + config.inputs.nixos-unstable.result.${system}.bluesky-pds.overrideAttrs (prevAttrs: { 87 + postBuild = '' 88 + rm -r node_modules/.pnpm/@atproto+pds@0.4.169 89 + mkdir -p node_modules/.pnpm/@atproto+pds@0.4.169 90 + ln -s ${ 91 + config.packages.bluesky-atproto-pds.result.${system} 92 + }/lib node_modules/.pnpm/@atproto+pds@0.4.169/node_modules 93 + ''; 94 + }); 95 + }; 96 + }
+1
packetmix/packages/default.nix
··· 8 ./beancount-beancount_plugin_utils 9 ./beancount-beancount_share 10 ./beancount-smart_importer 11 ./collabora-gtimelog 12 ./headscale 13 ./jujutsu
··· 8 ./beancount-beancount_plugin_utils 9 ./beancount-beancount_share 10 ./beancount-smart_importer 11 + ./bluesky-pds 12 ./collabora-gtimelog 13 ./headscale 14 ./jujutsu
+19 -1
packetmix/systems/teal/pds.nix
··· 3 # SPDX-License-Identifier: MIT 4 5 { 6 - services.pds = { 7 enable = true; 8 settings = { 9 PDS_HOSTNAME = "pds.freshly.space"; 10 PDS_PORT = 1033;
··· 3 # SPDX-License-Identifier: MIT 4 5 { 6 + project, 7 + pkgs, 8 + system, 9 + ... 10 + }: 11 + { 12 + disabledModules = [ "services/web-apps/pds.nix" ]; 13 + imports = [ 14 + "${project.inputs.nixos-unstable.src}/nixos/modules/services/web-apps/bluesky-pds.nix" 15 + ]; 16 + 17 + nixpkgs.overlays = [ 18 + (final: prev: { 19 + bluesky-pdsadmin = final.pdsadmin; 20 + }) 21 + ]; 22 + 23 + services.bluesky-pds = { 24 enable = true; 25 + package = project.packages.bluesky-pds.result.${system}; 26 settings = { 27 PDS_HOSTNAME = "pds.freshly.space"; 28 PDS_PORT = 1033;