From: Jakub Czajka Date: Sun, 22 Nov 2026 21:05:52 +0000 (+0000) Subject: [home][vps] Use pre-complied pi on vps. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=28e44ca74a5e6183b421a64f469971c6f0575533;p=guix.git [home][vps] Use pre-complied pi on vps. Remove the npm-built workaround. Exclude the optional X11 clipboard addon. Install pi in vps-home and add a test for it. --- diff --git a/.gitignore b/.gitignore index 4824265..3121190 100644 --- a/.gitignore +++ b/.gitignore @@ -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 5478b97..b1b1437 100644 --- a/README +++ b/README @@ -27,20 +27,20 @@ Files configurations. * / - 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 + $ scripts/generate-npm-hash -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 13ebf4e..35ed14a 100644 --- 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. diff --git a/conf/home/paseo.scm b/conf/home/paseo.scm index 0357f84..73d0b82 100644 --- a/conf/home/paseo.scm +++ b/conf/home/paseo.scm @@ -5,7 +5,7 @@ ;; ;; The hash is produced by scripts/generate-npm-hash: ;; -;; scripts/generate-npm-hash paseo +;; scripts/generate-npm-hash (define-module (conf home paseo) #:use-module (guix packages) diff --git a/conf/home/pi.scm b/conf/home/pi.scm index 28bb28d..f789eb2 100644 --- a/conf/home/pi.scm +++ b/conf/home/pi.scm @@ -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'. diff --git a/scripts/generate-npm-hash b/scripts/generate-npm-hash index 884f038..465beb7 100755 --- a/scripts/generate-npm-hash +++ b/scripts/generate-npm-hash @@ -4,10 +4,10 @@ # # generate-npm-hash — produce a pre-built npm tree and print its guix hash. # -# Usage: generate-npm-hash +# Usage: generate-npm-hash # -# npm-installs the named package at the given version, creates a -# -built-/ directory with node_modules/, and prints the +# npm-installs paseo at the given version, creates a +# paseo-built-/ 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 @@ -16,34 +16,23 @@ set -o errexit -o nounset -if [ $# -ne 2 ]; then - echo "Usage: generate-npm-hash " >&2 +if [ $# -ne 1 ]; then + echo "Usage: generate-npm-hash " >&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" diff --git a/tests/vps-home.scm b/tests/vps-home.scm index 1576f50..ae30c70 100644 --- a/tests/vps-home.scm +++ b/tests/vps-home.scm @@ -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")) @@ -115,7 +119,12 @@ ,%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 @@ -149,10 +158,8 @@ (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" @@ -223,6 +230,11 @@ (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 @@ -244,6 +256,7 @@ (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) diff --git a/vps-home.scm b/vps-home.scm index 4abdf43..8b79cca 100644 --- a/vps-home.scm +++ b/vps-home.scm @@ -11,13 +11,14 @@ #: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