]> git.ekhem.eu.org Git - guix.git/commitdiff
[home] Introduce Claude Code settings.json installed via Guix home.
authorJakub Czajka <jakub@ekhem.eu.org>
Sat, 20 Jun 2026 22:39:24 +0000 (00:39 +0200)
committerJakub Czajka <jakub@ekhem.eu.org>
Wed, 24 Jun 2026 22:53:20 +0000 (00:53 +0200)
- Add claude/.config/claude/settings.json with model overrides, max
- effort and apiKeyHelper wired to pass.
- Add conf/home/claude.scm service module bundling the claude-code
  package with its dotfile.
- Wire claude-service into home.scm, replacing the raw claude-code
  package.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
claude/.config/claude/settings.json [new file with mode: 0644]
claude/.local/bin/get-api-key [new file with mode: 0755]
conf/home/claude.scm [new file with mode: 0644]
home.scm

diff --git a/claude/.config/claude/settings.json b/claude/.config/claude/settings.json
new file mode 100644 (file)
index 0000000..5cd0677
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "env": {
+    "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
+    "ANTHROPIC_MODEL": "deepseek-v4-pro[1m]",
+    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro[1m]",
+    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro[1m]",
+    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
+    "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash",
+    "CLAUDE_CODE_EFFORT_LEVEL": "max"
+  },
+  "apiKeyHelper": "${HOME}/.local/bin/get-api-key"
+}
diff --git a/claude/.local/bin/get-api-key b/claude/.local/bin/get-api-key
new file mode 100755 (executable)
index 0000000..c42ed7d
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Copyright (c) 2026 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# Cache the API key in a per-session tmpfs so pass(1) only prompts for the GPG
+# password once per login session.
+
+set -o errexit
+
+GUIX_BIN="/run/current-system/profile/bin"
+CACHE="${XDG_RUNTIME_DIR:-/tmp}/claude-apikey"
+
+if [ -f "${CACHE}" ]; then
+    "${GUIX_BIN}/cat" "${CACHE}"
+else
+    (umask 077; pass show platforms/deepseek \
+        | "${GUIX_BIN}/sed" --quiet 's/^api-key: //p' \
+        > "${CACHE}")
+    "${GUIX_BIN}/cat" "${CACHE}"
+fi
diff --git a/conf/home/claude.scm b/conf/home/claude.scm
new file mode 100644 (file)
index 0000000..5598093
--- /dev/null
@@ -0,0 +1,19 @@
+;; Copyright (c) 2026 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; claude.scm - Claude Code home service with dotfiles.
+
+(define-module (conf home claude)
+  #:use-module (conf home claude-code)
+  #:use-module (conf home program)
+  #:use-module (gnu services)
+  #:export (claude-service))
+
+(define claude-dotfiles
+  (list "claude/.config/claude/settings.json"
+        "claude/.local/bin/get-api-key"))
+
+(define claude-service
+  (service home-program-service-type
+           (home-program-configuration (packages (list claude-code))
+                                       (dotfiles claude-dotfiles))))
index ddc4b94e0027368385c252fa26c57bb4ca7b1938..a344388ef130b88e8fa8ec5cb17b178d9cea5f52 100644 (file)
--- a/home.scm
+++ b/home.scm
@@ -9,7 +9,7 @@
 
 (use-modules (gnu home)
              (conf home bash)
-             (conf home claude-code)
+             (conf home claude)
              (conf home emoji)
              (conf home desktop)
              (conf home emacs)
   (home-environment
     (packages (case profile
                 ((nonfree)
-                 (list claude-code firefox select-emoji st-libxft-bgra))
+                 (list firefox select-emoji st-libxft-bgra))
                 ((libre)
                  (list icecat-minimal select-emoji st-libxft-bgra))))
     (services
      (case profile
        ((nonfree)
-        (append (list autorandr-service channels-service notify-service
-                      screenshot-service) bash-services desktop-services
-                emacs-services))
+        (append (list autorandr-service channels-service claude-service
+                      notify-service screenshot-service) bash-services
+                desktop-services emacs-services))
        ((libre)
         (append (list autorandr-service notify-service screenshot-service)
                 bash-services desktop-services emacs-services))))))