From d82c8996c0cf44530b5aa43da8bdf69a31e0a116 Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Thu, 9 Jul 2026 15:04:33 +0200 Subject: [PATCH] [home] Extract claude-code package to its own module. Co-Authored-By: Claude --- conf/home/claude-code.scm | 80 --------------------------------------- conf/home/claude.scm | 78 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 83 deletions(-) delete mode 100644 conf/home/claude-code.scm diff --git a/conf/home/claude-code.scm b/conf/home/claude-code.scm deleted file mode 100644 index edcac1b..0000000 --- a/conf/home/claude-code.scm +++ /dev/null @@ -1,80 +0,0 @@ -;; Copyright (c) 2026 Jakub Czajka -;; License: GPL-3.0 or later. -;; -;; claude-code.scm - package definition for Claude Code. -;; -;; The upstream binary is prebuilt for systems with Filesystem Hierarchy -;; Standard and expects a standard linker path. GNU Guix uses non-standard store -;; paths, so we wrap the binary in a shell script that sets LD_LIBRARY_PATH to -;; the store locations of its dependencies and invokes it through ld-linux. - -(define-module (conf home claude-code) - #:use-module (guix packages) - #:use-module (guix download) - #:use-module (guix gexp) - #:use-module (guix build-system trivial) - #:use-module (gnu packages base) - #:use-module (gnu packages gcc) - #:use-module (gnu packages tls) - #:use-module (gnu packages compression) - #:use-module (gnu packages bash) - #:export (claude-code)) - -(define claude-code - (package - (name "claude-code") - (version "2.1.185") - (source - (origin - (method url-fetch) - (uri (string-append "https://downloads.claude.ai/claude-code-releases/" - version "/linux-x64/claude")) - (sha256 - (base32 "0lir62y47bbdkkkbs505issbm86p9rnkzvkxc87fw14zd4w66971")))) - (build-system trivial-build-system) - (arguments - (list - #:modules '((guix build utils)) - #:builder - #~(begin - (use-modules (guix build utils)) - (let* ((out #$output) - (bin (string-append out "/bin")) - (internal-bin (string-append out "/libexec")) - (real-binary (string-append internal-bin "/claude")) - (wrapper (string-append bin "/claude")) - (bash (string-append #$bash-minimal "/bin/bash")) - (ld-linux (string-append #$glibc "/lib/ld-linux-x86-64.so.2")) - ;; Define runtime library path for the wrapper. - (lib-path (string-append #$glibc - "/lib:" - #$gcc:lib - "/lib:" - #$gcc:lib - "/lib64:" - #$openssl - "/lib:" - #$zlib - "/lib"))) - ;; 1. Copy the raw binary into an isolated internal path. - (mkdir-p internal-bin) - (copy-file #$source real-binary) - (chmod real-binary #o755) - ;; 2. Generate a shell wrapper that invokes the binary - ;; using Guix's linker. - (mkdir-p bin) - (with-output-to-file wrapper - (lambda () - (format #t "#!~a~%" bash) - (format #t "export LD_LIBRARY_PATH=\"~a:" lib-path) - (format #t "$LD_LIBRARY_PATH\"~%") - ;; Invoke the explicit linker, passing CLI args. - (format #t "exec ~a ~a \"$@\"~%" ld-linux real-binary))) - (chmod wrapper #o755))))) - (inputs (list glibc - `(,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.") - ;; Claude Code is proprietary software, not end-user redistributable. - (license #f))) diff --git a/conf/home/claude.scm b/conf/home/claude.scm index 47f0183..d68c122 100644 --- a/conf/home/claude.scm +++ b/conf/home/claude.scm @@ -1,13 +1,85 @@ ;; Copyright (c) 2026 Jakub Czajka ;; License: GPL-3.0 or later. ;; -;; claude.scm - Claude Code home service with dotfiles. +;; claude.scm - Claude Code package and home service with dotfiles. +;; +;; The upstream binary is prebuilt for systems with Filesystem Hierarchy +;; Standard and expects a standard linker path. GNU Guix uses non-standard store +;; paths, so we wrap the binary in a shell script that sets LD_LIBRARY_PATH to +;; the store locations of its dependencies and invokes it through ld-linux. (define-module (conf home claude) - #:use-module (conf home claude-code) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix gexp) + #:use-module (guix build-system trivial) + #:use-module (gnu packages base) + #:use-module (gnu packages gcc) + #:use-module (gnu packages tls) + #:use-module (gnu packages compression) + #:use-module (gnu packages bash) #:use-module (conf home program) #:use-module (gnu services) - #:export (claude-service)) + #:export (claude-code claude-service)) + +(define claude-code + (package + (name "claude-code") + (version "2.1.185") + (source + (origin + (method url-fetch) + (uri (string-append "https://downloads.claude.ai/claude-code-releases/" + version "/linux-x64/claude")) + (sha256 + (base32 "0lir62y47bbdkkkbs505issbm86p9rnkzvkxc87fw14zd4w66971")))) + (build-system trivial-build-system) + (arguments + (list + #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + (let* ((out #$output) + (bin (string-append out "/bin")) + (internal-bin (string-append out "/libexec")) + (real-binary (string-append internal-bin "/claude")) + (wrapper (string-append bin "/claude")) + (bash (string-append #$bash-minimal "/bin/bash")) + (ld-linux (string-append #$glibc "/lib/ld-linux-x86-64.so.2")) + ;; Define runtime library path for the wrapper. + (lib-path (string-append #$glibc + "/lib:" + #$gcc:lib + "/lib:" + #$gcc:lib + "/lib64:" + #$openssl + "/lib:" + #$zlib + "/lib"))) + ;; 1. Copy the raw binary into an isolated internal path. + (mkdir-p internal-bin) + (copy-file #$source real-binary) + (chmod real-binary #o755) + ;; 2. Generate a shell wrapper that invokes the binary + ;; using Guix's linker. + (mkdir-p bin) + (with-output-to-file wrapper + (lambda () + (format #t "#!~a~%" bash) + (format #t "export LD_LIBRARY_PATH=\"~a:" lib-path) + (format #t "$LD_LIBRARY_PATH\"~%") + ;; Invoke the explicit linker, passing CLI args. + (format #t "exec ~a ~a \"$@\"~%" ld-linux real-binary))) + (chmod wrapper #o755))))) + (inputs (list glibc + `(,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.") + ;; Claude Code is proprietary software, not end-user redistributable. + (license #f))) (define claude-dotfiles (list "claude/.config/claude/settings.json" -- 2.47.3