]> git.ekhem.eu.org Git - guix.git/commitdiff
[home] Fix Claude Code integration: seeded config, dark theme, VM tests.
authorJakub Czajka <jakub@ekhem.eu.org>
Fri, 31 Jul 2026 09:44:52 +0000 (09:44 +0000)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 22 Nov 2026 10:42:39 +0000 (10:42 +0000)
TODO
claude/.config/claude/settings.json
conf/home/claude.scm
conf/home/paseo.scm
tests/vps-home.scm

diff --git a/TODO b/TODO
index bf1a247d2a7b635bda130a73dd456ced58af60ca..13ebf4e16059c49cd31e95a72f98a803695bdbb8 100644 (file)
--- a/TODO
+++ b/TODO
@@ -17,9 +17,11 @@ TODO
   in conf/home/pi.scm.
 
 * When Claude Code supports separating config from runtime state (e.g.
-  separate CLAUDE_STATE_DIR env var), remove the symlink and --settings
-  flag from the claude-code wrapper; point CLAUDE_CONFIG_DIR directly
-  to $out/etc.
+  separate CLAUDE_STATE_DIR env var), remove the first-run seeding logic
+  from the claude-code wrapper and point CLAUDE_CONFIG_DIR directly to
+  $out/etc for truly immutable config.  State would live in
+  CLAUDE_STATE_DIR (~/.local/state/claude) while config stays read-only
+  from the store.
 
 * When Paseo triggers Claude Code from mobile, get-api-key runs pass(1) which
   prompts for a GPG passphrase on a headless terminal — the session hangs.
@@ -35,3 +37,7 @@ TODO
   currently spawn subshells or cd manually to operate in the right
   directory.  SetCwd would let them change the harness working
   directory directly, eliminating the subshell overhead.
+
+* Remove claude-proxy once DeepSeek supports the Messages
+  API natively.  Tracked at:
+  https://github.com/deepseek-ai/awesome-deepseek-agent/issues/284
index 5cd0677c59b3517c9cdbf44b6bb82581d1fa2c26..fcac696adca08d2b67251c7df3e050bf3982f210 100644 (file)
@@ -1,4 +1,5 @@
 {
+  "theme": "dark",
   "env": {
     "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
     "ANTHROPIC_MODEL": "deepseek-v4-pro[1m]",
index 5cbe3efecbb91d7b12c7a683827dd99ae1ba584f..7eb7f30548e851350aa15b7d6d56a9a7768d4bef 100644 (file)
@@ -13,7 +13,6 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages bash)
-  #:use-module (gnu packages elf)
   #:export (claude-code))
 
 (define settings-file
           (let* ((out #$output)
                  (bin (string-append out "/bin"))
                  (etc (string-append out "/etc"))
-                 (binary (string-append bin "/claude"))
+                 (libexec (string-append out "/libexec"))
+                 (real-binary (string-append libexec "/claude"))
+                 (wrapper (string-append bin "/claude"))
                  (api-helper (string-append etc "/get-api-key"))
-                 (patchelf #$(file-append patchelf "/bin/patchelf"))
+                 (bash #$(file-append bash-minimal "/bin/bash"))
                  (ld-so #$(file-append glibc "/lib/ld-linux-x86-64.so.2"))
-                 (rpath (string-append #$glibc
-                                       "/lib:"
-                                       #$gcc:lib
-                                       "/lib:"
-                                       #$gcc:lib
-                                       "/lib64:"
-                                       #$openssl
-                                       "/lib:"
-                                       #$zlib
-                                       "/lib")))
-            ;; 1. Copy the binary and patch its ELF.
-            (mkdir-p bin)
-            (copy-file #$source binary)
-            (chmod binary #o755)
-            (invoke patchelf "--set-interpreter" ld-so binary)
-            (invoke patchelf "--set-rpath" rpath binary)
-            ;; 2. Copy and patch configuration files.
+                 (lib-path (string-append (string-append #$glibc "/lib:")
+                                          (string-append #$gcc:lib "/lib:")
+                                          (string-append #$gcc:lib "/lib64:")
+                                          (string-append #$openssl "/lib:")
+                                          (string-append #$zlib "/lib"))))
+            ;; 1. Install the real binary in libexec.
+            (mkdir-p libexec)
+            (copy-file #$source real-binary)
+            (chmod real-binary #o755)
+            ;; 2. Copy and patch configuration.
             (mkdir-p etc)
             (copy-file #$instructions-file
                        (string-append etc "/CLAUDE.md"))
             ;; 3. Copy the API key helper.
             (copy-file #$api-key-file api-helper)
             (chmod api-helper #o755)
-            ;; 4. Wrap the binary to set CLAUDE_CONFIG_DIR.
-            ;; wrap-program needs bash in PATH for the shebang.
-            (setenv "PATH"
-                    (string-append #$bash-minimal "/bin"))
-            (wrap-program binary
-              `("CLAUDE_CONFIG_DIR" =
-                (,etc)))))))
+            ;; 4. Generate a wrapper that seeds a writable
+            ;; config directory in $HOME on first run,
+            ;; then invokes the binary through ld-linux.
+            (mkdir-p bin)
+            (with-output-to-file wrapper
+              (lambda ()
+                (format #t "#!~a~%" bash)
+                (format #t ": \"${HOME:=/root}\"~%")
+                (format #t "CONFIG_DIR=\"${HOME}/.config/claude\"~%")
+                (format #t "STORE_ETC=\"~a\"~%" etc)
+                (format #t "if [ ! -d \"${CONFIG_DIR}\" ]; then~%")
+                (format #t "    mkdir -p \"${CONFIG_DIR}\"~%")
+                (format #t "    cp \"${STORE_ETC}/settings.json\"")
+                (format #t " \"${CONFIG_DIR}/\"~%")
+                (format #t "    cp \"${STORE_ETC}/CLAUDE.md\"")
+                (format #t " \"${CONFIG_DIR}/\"~%")
+                (format #t "fi~%")
+                (format #t "export CLAUDE_CONFIG_DIR=\"${CONFIG_DIR}\"~%")
+                (format #t "export LD_LIBRARY_PATH=\"~a:" lib-path)
+                (format #t "$LD_LIBRARY_PATH\"~%")
+                (format #t "exec ~a ~a \"$@\"~%" ld-so real-binary)))
+            (chmod wrapper #o755)))))
     (inputs (list glibc
-                  `(,gcc "lib")
-                  openssl
-                  zlib
-                  bash-minimal
-                  patchelf))
+                  `(,gcc "lib") openssl zlib bash-minimal))
     (home-page "https://claude.ai")
     (synopsis "Agentic coding tool that lives in your terminal")
-    (description "Claude Code is a CLI tool that understands your codebase.")
+    (description "Claude Code is a CLI tool that understands your
+codebase.")
     ;; Claude Code is proprietary software, not end-user redistributable.
     (license #f)))
index e24f83546d56a1e35cf79cf9a6b249967424a5a6..327e420afb34864f23cafced5a580bb2d778fa3e 100644 (file)
@@ -43,8 +43,7 @@
                                      (node #$(file-append node-lts "/bin/node"))
                                      (bash #$(file-append bash-minimal
                                                           "/bin/bash"))
-                                     (claude-etc #$(file-append claude-code
-                                                                "/etc"))
+                                     (config-dir "${HOME}/.config/claude")
                                      (wrapper (string-append bin "/paseo")))
                                 (mkdir-p bin)
                                 (with-output-to-file wrapper
@@ -52,7 +51,7 @@
                                     (format #t "#!~a~%" bash)
                                     (format #t
                                             "export CLAUDE_CONFIG_DIR=\"~a\"~%"
-                                            claude-etc)
+                                            config-dir)
                                     (format #t "exec ~a \"~a\" \"$@\"~%" node
                                             entry-path)))
                                 (chmod wrapper #o755))))))
index d877a2ccafde191bededeb1b8b0beef5e8c7cdff..b67f5789c0aa3fa4cb0283fb8f6b67923da8272c 100644 (file)
@@ -6,8 +6,6 @@
 (define-module (tests vps-home)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages base)
-  #:use-module (conf home claude)
-  #:use-module (conf home paseo)
   #:use-module (guix gexp)
   #:use-module (tests vps-system)
   #:use-module (vps-home)
@@ -15,6 +13,8 @@
 
 (define %activate
   (file-append vps-home-environment "/activate"))
+(define %herd
+  (file-append vps-home-environment "/profile/bin/herd"))
 (define %timeout
   (file-append coreutils "/bin/timeout"))
 
                  read-string)))
      (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)))
+
 (define (assert-home marionette label body)
   #~(test-assert #$label
                  (let ((result (marionette-eval '#$body
                          (format (current-error-port) "~a: ~s~%"
                                  #$label result) #f)))))
 
-(define %paseo-timeout-body
-  (let ((bin (file-append paseo "/bin/paseo"))
-        (timeout (file-append coreutils "/bin/timeout")))
-    `(let* ((st (system* ,timeout
-                         "5"
-                         ,bin
-                         "daemon"
-                         "start"
-                         "--foreground"))
-            (rc (status:exit-val st)))
-       (= rc 124))))
-
 (define (vps-home-test-cases marionette)
   #~(begin
       (marionette-eval '#$%home-prelude
                        #$marionette)
       #$(assert-home marionette "home: vps-home activates"
                      %home-activation-body)
-      (test-assert "home: dak user exists"
-                   (marionette-eval '(file-exists? "/home/dak")
-                                    #$marionette))
-      (test-assert "home: claude binary exists"
-                   (marionette-eval '(file-exists? (string-append #$claude-code
-                                                    "/bin/claude"))
-                                    #$marionette))
-      (test-assert "home: paseo binary exists"
-                   (marionette-eval '(file-exists? (string-append #$paseo
-                                                    "/bin/paseo"))
-                                    #$marionette))
-      (test-assert "home: .guile exists"
-                   (marionette-eval '(file-exists? "/home/dak/.guile")
-                                    #$marionette))
-      (test-assert "paseo: daemon starts"
-                   (marionette-eval '#$%paseo-timeout-body
-                                    #$marionette))))
+      #$(assert-home marionette "home: paseo-daemon is running"
+                     (home-herd-body "paseo-daemon"))))