From d71ffec00fff92e316bdebc11bd009a096ed3e30 Mon Sep 17 00:00:00 2001 From: Callie Peden Date: Sun, 12 Apr 2026 01:57:57 -0400 Subject: [PATCH] working flake --- .gitignore | 1 + flake.nix | 29 ++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 12a09a8f..1c56ca3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +result node_modules/ dist/ *.log diff --git a/flake.nix b/flake.nix index fc1001de..0e92ffd9 100644 --- a/flake.nix +++ b/flake.nix @@ -23,12 +23,21 @@ npmDepsHash = "sha256-ZR9KAu9zKqYw7Kduf2lkijNVJ03iGzUhty8txSSliD4="; # nix will tell you the hash on first build - nativeBuildInputs = with pkgs; [ git makeWrapper pkg-config pixman ]; - - # skip native addon compilation (canvas, koffi, etc. are web-ui deps, not needed here) - npmInstallFlags = [ "--ignore-scripts" ]; - - npmBuildScript = "build"; + nativeBuildInputs = with pkgs; [ git makeWrapper pkg-config python3 ]; + buildInputs = with pkgs; [ pixman cairo libpng pango freetype ]; + + # build each package manually so we can skip generate-models (needs network) for ai + buildPhase = '' + runHook preBuild + cd packages/tui && npm run build && cd ../.. + cd packages/ai && npx tsgo -p tsconfig.build.json && cd ../.. + cd packages/agent && npm run build && cd ../.. + cd packages/coding-agent && npm run build && cd ../.. + cd packages/mom && npm run build && cd ../.. + cd packages/web-ui && npm run build && cd ../.. + cd packages/pods && npm run build && cd ../.. + runHook postBuild + ''; dontNpmInstall = true; installPhase = '' @@ -36,8 +45,14 @@ mkdir -p $out/lib/pi-coding-agent/node_modules/@mariozechner - # copy all node_modules (external deps) + # copy node_modules, then replace workspace symlinks with real built dirs cp -r node_modules/* $out/lib/pi-coding-agent/node_modules/ + # remove dangling top-level workspace symlinks (examples, web-ui, etc.) + find $out/lib/pi-coding-agent/node_modules -maxdepth 1 -type l | while read link; do + if [ ! -e "$link" ]; then rm "$link"; fi + done + # remove all workspace package symlinks under @mariozechner + find $out/lib/pi-coding-agent/node_modules/@mariozechner -maxdepth 1 -type l | xargs rm -f # copy built workspace packages cp -r packages/tui $out/lib/pi-coding-agent/node_modules/@mariozechner/pi-tui -- 2.51.2