]> git.ekhem.eu.org Git - guix.git/commitdiff
[home][vps] Use pre-complied pi on vps.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 22 Nov 2026 21:05:52 +0000 (21:05 +0000)
committerJakub Czajka <jakub@ekhem.eu.org>
Tue, 24 Nov 2026 15:54:44 +0000 (15:54 +0000)
Remove the npm-built workaround. Exclude the optional X11 clipboard addon. Install pi in vps-home and add a test for it.

.gitignore
README
TODO
conf/home/paseo.scm
conf/home/pi.scm
scripts/generate-npm-hash
tests/vps-home.scm
vps-home.scm

index 48242650110472c46e0b8aa13efff5ad238361ad..3121190c3f3b45fc0922cf36968d993c4cbead23 100644 (file)
@@ -1,7 +1,6 @@
 .claude/.build-queue.*
 .claude/worktrees
 .dir-locals.el
-pi-built-*/
-pi-tmp/
+pi-linux-x64.tar.gz
 paseo-built-*/
 paseo-tmp/
diff --git a/README b/README
index 5478b97db3b02fff1e4fded9ba8a00b25ed9098c..b1b14378c461f7b066a3f77c6c0f70155eff5fba 100644 (file)
--- a/README
+++ b/README
@@ -27,20 +27,20 @@ Files
                  configurations.
 * <program>/   - program-specific dotfiles.
 
-Updating npm-based packages
----------------------------
+Updating the npm-based package
+------------------------------
 
-Some packages are built from pre-built npm trees because their dependency
-trees are too large for recursive Guix packaging.
+The Paseo package is built from a pre-built npm tree because its dependency
+tree is too large for recursive Guix packaging.
 ``scripts/generate-npm-hash`` handles the update:
 
-  $ scripts/generate-npm-hash <name> <version>
+  $ scripts/generate-npm-hash <version>
 
-This npm-installs the named package at the given version and prints the
-``guix hash`` for the resulting ``node_modules/`` tree.  Copy that hash
-into the package definition's ``local-file`` reference.
+This npm-installs paseo at the given version and prints the ``guix hash``
+for the resulting ``node_modules/`` tree.  Copy that hash into the package
+definition's ``local-file`` reference.
 
-You only need to run this script when bumping the npm package version
+You only need to run this script when bumping the paseo version
 -- ``guix home reconfigure`` uses the hash baked into the definition and
 never runs ``npm install`` itself.
 
diff --git a/TODO b/TODO
index 13ebf4e16059c49cd31e95a72f98a803695bdbb8..35ed14ac5ad4c1211a3ab5aa0d5e8050ef5ad366 100644 (file)
--- a/TODO
+++ b/TODO
@@ -7,14 +7,6 @@ TODO
   2. Update the version field in conf/home/claude.scm.
   3. Add claude-code at the end, run guix build -f conf/home/claude.scm and
      get the correct hash from the "hash mismatch" error message.
-* Go back to the upstream pi release tarball once Bun's --compile bug is
-  fixed.  Bun 1.2.20-1.3.11 produces broken binaries; 1.3.14 fails
-  entirely on this system (kernel 7.0.14, glibc 2.39).  As of pi 0.82.0
-  (2026-07-24), the upstream CI still builds with a broken Bun, so the
-  problem persists.  When a fixed Bun is available, just download the
-  tarball, extract the binary, and wrap it -- no build step needed.
-  Remove the npm-install-build-system wrapper and the Node.js dependency
-  in conf/home/pi.scm.
 
 * When Claude Code supports separating config from runtime state (e.g.
   separate CLAUDE_STATE_DIR env var), remove the first-run seeding logic
@@ -41,3 +33,9 @@ TODO
 * Remove claude-proxy once DeepSeek supports the Messages
   API natively.  Tracked at:
   https://github.com/deepseek-ai/awesome-deepseek-agent/issues/284
+
+* Add pi's X11 clipboard addon back when image or file-path paste is
+  needed.  It lives under native/ in the pi tarball and is excluded in
+  conf/home/pi.scm.  Re-include it and give linux-platform-x11.node a
+  RUNPATH to libxcb; the addon only loads when DISPLAY is set, and text
+  clipboard works without it through xclip.
index 0357f84f67ca8b16d0302d31d58ab8ed86ed4b8b..73d0b82140663a78bedf2f181e12940cfea27e24 100644 (file)
@@ -5,7 +5,7 @@
 ;;
 ;; The hash is produced by scripts/generate-npm-hash:
 ;;
-;;   scripts/generate-npm-hash paseo <version>
+;;   scripts/generate-npm-hash <version>
 
 (define-module (conf home paseo)
   #:use-module (guix packages)
index 28bb28d65a7046e293d21710c7b4e47ef8285984..f789eb2b18be1bc494287364cc80f734c4a4c0cf 100644 (file)
@@ -2,32 +2,66 @@
 ;; License: GPL-3.0 or later.
 ;;
 ;; pi.scm — package for the Pi coding agent.
-;; Built from npm in a fixed-output derivation.
+;; Built from the upstream Bun-compiled release tarball.
 
 (define-module (conf home pi)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
+  #:use-module (guix download)
   #:use-module (guix base32)
+  #:use-module (guix build-system copy)
   #:use-module ((guix licenses)
                 #:prefix license:)
-  #:use-module (conf home npm)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages elf)
   #:export (pi))
 
 (define pi
   (package
     (name "pi-coding-agent")
-    (version "0.80.3")
+    (version "1.6.0")
     (source
-     #f)
-    (build-system npm-install-build-system)
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/earendil-works/pi/releases/download/v"
+             version "/pi-linux-x64.tar.gz"))
+       (sha256
+        (base32 "1lb5axmfkvlqbjbf9pq0a0jmr49wz9ibiqd14nsdwfwv6zjdnxzg"))))
+    (build-system copy-build-system)
     (arguments
      (list
-      #:name "pi"
-      #:npm-package "@earendil-works/pi-coding-agent"
-      #:version "0.80.3"
-      #:entry
-      "@earendil-works/pi-coding-agent/packages/coding-agent/dist/cli.js"
-      #:hash (nix-base32-string->bytevector
-              "0ai50vd5kfd07ihmyj2kavhbdhh65pjj981cxpm0llg9hwxsg6ph")))
+      #:install-plan
+      #~'(("." "libexec/pi"
+           #:exclude-regexp ("^[.]/docs/images/" "^[.]/native/")))
+      #:strip-binaries? #f
+      ;; The Bun binary lists ld-linux as NEEDED, which runpath validation
+      ;; cannot satisfy; patching its RUNPATH corrupts it.
+      #:validate-runpath? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'patch-pi
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (binary (string-append out "/libexec/pi/pi"))
+                     (wrapper (string-append out "/bin/pi"))
+                     (patchelf #$(file-append patchelf "/bin/patchelf"))
+                     (loader #$(file-append glibc "/lib/ld-linux-x86-64.so.2")))
+                (invoke patchelf "--set-interpreter" loader binary)
+                (mkdir-p (dirname wrapper))
+                (call-with-output-file wrapper
+                  (lambda (port)
+                    (format port
+                            (string-append "#!~a~%"
+                             "export PI_CODING_AGENT_DIR="
+                             "\"${PI_CODING_AGENT_DIR:-$HOME/.config/pi}\"~%"
+                             "exec ~a \"$@\"~%")
+                            #$(file-append bash-minimal "/bin/bash") binary)))
+                (chmod wrapper #o755)))))))
+    (inputs (list bash-minimal glibc))
+    (native-inputs (list patchelf))
+    (supported-systems '("x86_64-linux"))
     (home-page "https://github.com/earendil-works/pi")
     (synopsis "Terminal-based AI coding agent")
     (description "Pi is a minimal, extensible terminal coding agent harness.
@@ -36,6 +70,5 @@ execute code in your project.  Configuration is stored in
 @file{~/.config/pi/}.")
     (license license:expat)))
 
-;;; Update: run ./scripts/generate-npm-hash pi NEW-VERSION, then
-;;; update the version strings and hash in the package definition
-;;; above.
+;;; Update: bump the version and refresh the hash with
+;;; `guix hash pi-linux-x64.tar.gz'.
index 884f03810cb94b7b50c369f39b073c7eaef71b10..465beb7d33fe90fe4b09664c92cae61b5fcc7d2c 100755 (executable)
@@ -4,10 +4,10 @@
 #
 # generate-npm-hash — produce a pre-built npm tree and print its guix hash.
 #
-# Usage: generate-npm-hash <name> <version>
+# Usage: generate-npm-hash <version>
 #
-# npm-installs the named package at the given version, creates a
-# <name>-built-<version>/ directory with node_modules/, and prints the
+# npm-installs paseo at the given version, creates a
+# paseo-built-<version>/ directory with node_modules/, and prints the
 # guix hash for a local-file reference.
 #
 # Run this only when bumping the npm package version — guix home
 
 set -o errexit -o nounset
 
-if [ $# -ne 2 ]; then
-    echo "Usage: generate-npm-hash <name> <version>" >&2
+if [ $# -ne 1 ]; then
+    echo "Usage: generate-npm-hash <version>" >&2
     exit 1
 fi
 
-name=$1
-version=$2
-
-case $name in
-    pi)
-        npm_pkg="@earendil-works/pi-coding-agent"
-        ;;
-    paseo)
-        npm_pkg="@getpaseo/cli"
-        ;;
-    *)
-        echo "Unknown package: $name" >&2
-        exit 1
-        ;;
-esac
+name=paseo
+version=$1
+npm_pkg="@getpaseo/cli"
 
 dir="${name}-built-${version}"
 tmp="${name}-tmp"
 
 rm -rf "$dir" "$tmp"
 mkdir "$tmp"
-echo "{\"dependencies\": {\"$npm_pkg\": \"$version\"}}" > "$tmp/package.json"
-(cd "$tmp" && npm install --production)
+printf '{"name": "npm-build", "dependencies": {"%s": "%s"}}\n' \
+    "$npm_pkg" "$version" > "$tmp/package.json"
+(cd "$tmp" && npm install --production --ignore-scripts)
 mkdir -p "$dir"
 cp --recursive "$tmp/node_modules" "$dir/"
 rm -rf "$tmp"
index 1576f50f79506491a226848df11ec9690344c500..ae30c7003d841c486f82681ffb179267a122969d 100644 (file)
@@ -7,6 +7,8 @@
   #:use-module (gnu packages admin)
   #:use-module (gnu packages base)
   #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module (conf home pi)
   #:use-module (tests vps-system)
   #:use-module (vps-home)
   #:export (vps-home-test-cases))
@@ -20,6 +22,8 @@
   (file-append vps-home-environment "/profile/bin/herd"))
 (define %claude
   (file-append vps-home-environment "/profile/bin/claude"))
+(define %pi
+  (file-append vps-home-environment "/profile/bin/pi"))
 (define %timeout
   (file-append coreutils "/bin/timeout"))
 
                              ,%test-user
                              ,(file-append coreutils "/bin/env"))))
          (run-command-output (string-append prefix runtime-dir " " command
-                                            " 2>&1"))))))
+                                            " 2>&1"))))
+
+     (define (run-contains command needle)
+       (let ((result (run command)))
+         (and (car result)
+              (string-contains (cadr result) needle) #t)))))
 
 (define (req-with-options stream fields)
   (string-append "{\"stream\":" stream
      (car result)))
 
 (define (home-herd-body service)
-  `(let ((status (run (string-append ,%herd " status "
-                                     ,service))))
-     (and (car status)
-          (string-contains (cadr status) "It is running") #t)))
+  `(run-contains (string-append ,%herd " status "
+                                ,service) "It is running"))
 
 (define %health-stream-body
   `(let ((stream (fetch "/v1/messages"
      (and (car result)
           (string-contains (cadr result) "Hello from fake") #t)))
 
+(define %pi-version-body
+  `(run-contains (string-append "HOME=/tmp/pi-e2e "
+                                ,%pi " --version")
+                 ,(package-version pi)))
+
 (define (assert-home marionette label body)
   #~(test-assert #$label
                  (let ((result (marionette-eval '#$body
                      (home-herd-body "claude-proxy"))
       #$(assert-home marionette "home: paseo-daemon is running"
                      (home-herd-body "paseo-daemon"))
+      #$(assert-home marionette "home: pi runs" %pi-version-body)
       #$(assert-home marionette
                      "home: claude-proxy: health and incremental SSE"
                      %health-stream-body)
index 4abdf434f695ff8bbbea6c7ef5577c28066cdba8..8b79ccae8913a4387dd30a33b959105cdb807570 100644 (file)
   #:use-module (gnu system shadow)
   #:use-module (conf home claude-proxy)
   #:use-module (conf home paseo)
+  #:use-module (conf home pi)
   #:use-module (conf home claude)
   #:use-module (conf home symlink)
   #:export (vps-home-environment))
 
 (define vps-home-environment
   (home-environment
-    (packages (list claude-code git paseo))
+    (packages (list claude-code git paseo pi))
     (services
      (append (list paseo-daemon-service
                    claude-proxy-service