WIP! A BB-style forum, on the ATmosphere!
We're still working... we'll be back soon when we have something to show off!
node
typescript
hono
htmx
atproto
1{
2 lib,
3 stdenv,
4 nodejs_22,
5 pnpm_9,
6 bash,
7 makeWrapper,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "atbb";
12 version = "0.1.0";
13
14 src = lib.fileset.toSource {
15 root = ../.;
16 fileset = lib.fileset.unions [
17 ../package.json
18 ../pnpm-lock.yaml
19 ../pnpm-workspace.yaml
20 ../turbo.json
21 ../tsconfig.base.json
22 ../apps
23 ../packages
24 ];
25 };
26
27 pnpmDeps = pnpm_9.fetchDeps {
28 inherit (finalAttrs) pname version src;
29 fetcherVersion = 1;
30 hash = "sha256-V+Sj0Ch4offNmnd/V6x5OriDnYEHh4ISzw5S7SsaPzo=";
31 };
32
33 nativeBuildInputs = [
34 nodejs_22
35 pnpm_9.configHook
36 bash
37 makeWrapper
38 ];
39
40 buildPhase = ''
41 runHook preBuild
42 pnpm build
43 runHook postBuild
44 '';
45
46 installPhase = ''
47 runHook preInstall
48
49 mkdir -p $out
50
51 # Workspace config
52 cp package.json pnpm-lock.yaml pnpm-workspace.yaml $out/
53
54 # Root node_modules (pnpm virtual store — symlinks point into Nix store FOD)
55 cp -r node_modules $out/
56
57 # Each workspace package: package.json + dist/ + local node_modules symlinks
58 for pkg in apps/appview apps/web packages/db packages/atproto packages/cli packages/lexicon packages/logger; do
59 mkdir -p "$out/$pkg"
60 cp "$pkg/package.json" "$out/$pkg/"
61 [ -d "$pkg/dist" ] && cp -r "$pkg/dist" "$out/$pkg/"
62 [ -d "$pkg/node_modules" ] && cp -r "$pkg/node_modules" "$out/$pkg/"
63 done
64
65 # DB schema source (needed by drizzle.config.ts which references ../../packages/db/src/schema.ts)
66 cp -r packages/db/src $out/packages/db/
67
68 # Drizzle migrations (needed for db:migrate at deploy time)
69 cp -r apps/appview/drizzle $out/apps/appview/
70 cp -r apps/appview/drizzle-sqlite $out/apps/appview/
71
72 # Drizzle config files (needed by drizzle-kit migrate)
73 cp apps/appview/drizzle.postgres.config.ts $out/apps/appview/
74 cp apps/appview/drizzle.sqlite.config.ts $out/apps/appview/
75
76 # Web static assets (CSS, favicon — served by hono serveStatic)
77 cp -r apps/web/public $out/apps/web/
78
79 # CLI wrapper — makes `atbb` available on PATH
80 mkdir -p $out/bin
81 makeWrapper ${nodejs_22}/bin/node $out/bin/atbb \
82 --add-flags "$out/packages/cli/dist/index.js"
83
84 runHook postInstall
85 '';
86
87 meta = with lib; {
88 description = "atBB — decentralized BB-style forum on AT Protocol";
89 license = licenses.agpl3Only;
90 platforms = [ "x86_64-linux" "aarch64-linux" ];
91 };
92})