nongnu: Add claude-code.

* nongnu/packages/claude-code.scm (claude-code): New variable.
This commit is contained in:
Danny Milosavljevic 2026-01-06 21:20:10 +01:00
parent 97733329d5
commit e0020c3b5c
No known key found for this signature in database
GPG key ID: E71A35542C30BAA5

View file

@ -3328,6 +3328,87 @@ models to external tools and data sources.")
Claude Code SDK.")
(license license:asl2.0)))
;; Binary URL is from the official install script at
;; <https://claude.ai/install.sh>.
(define-public claude-code
(package
(name "claude-code")
(version "2.0.67")
(source
(let ((arch (match (or (%current-target-system) (%current-system))
("aarch64-linux" "linux-arm64")
(_ "linux-x64")))
(hash (match (or (%current-target-system) (%current-system))
("aarch64-linux"
"1j4nk8n8awcj529s390d5zl2p902zfm7gcpdshk4pdkdrfnvmqks")
(_
"1wr6cxrf608z22adhjwvx1rinxyv3rbjls00j3si8f6zsmwj58dj"))))
(origin
(method url-fetch)
(uri
(string-append
"https://storage.googleapis.com/claude-code-dist-"
"86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/"
version "/" arch "/claude"))
(sha256
(base32 hash)))))
(build-system copy-build-system)
(arguments
(list
#:validate-runpath? #f
#:strip-binaries? #f
#:install-plan
#~'(("claude" "libexec/claude"))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-proc-self-exe
(lambda _
;; Replace /proc/self/exe with /proc/self/ex_ to force Bun
;; to fall back to argv[0] for finding the embedded modules.
(invoke "sed" "-i" "s|/proc/self/exe|/proc/self/ex_|g" "claude")))
(add-after 'install 'make-binary-executable
(lambda _
(chmod (string-append #$output "/libexec/claude") #o555)))
(add-after 'make-binary-executable 'create-wrapper
(lambda _
(let ((bin (string-append #$output "/bin"))
(libexec (string-append #$output "/libexec/claude"))
(ld.so (string-append #$(this-package-input "glibc")
#$(glibc-dynamic-linker)))
(lib-path
(string-join
(list (string-append
#$(this-package-input "glibc") "/lib")
(string-append
#$(this-package-input "gcc:lib") "/lib"))
":")))
(mkdir-p bin)
(call-with-output-file (string-append bin "/claude")
(lambda (port)
(format port "#!~a
exec ~a --argv0 ~a --library-path ~a ~a \"$@\"~%"
#$(file-append bash-minimal "/bin/sh")
ld.so
libexec
lib-path
libexec)))
(chmod (string-append bin "/claude") #o755)))))))
(native-inputs
(list sed))
(inputs
`(("bash-minimal" ,bash-minimal)
("glibc" ,glibc)
("gcc:lib" ,gcc "lib")))
(supported-systems '("aarch64-linux" "x86_64-linux"))
(properties '((substitutable? . #f)))
(home-page "https://claude.ai/code")
(synopsis "AI coding agent for the terminal")
(description
"Claude Code is an agentic coding tool that lives in your terminal,
understands your codebase, and helps you code faster by executing routine
tasks, explaining complex code, and handling git workflows through natural
language commands.")
(license
(license:nonfree
"https://code.claude.com/docs/en/legal-and-compliance"))))