add uv package

This commit is contained in:
Peter Tillemans 2025-07-24 16:56:20 +02:00
parent b3ac1aa68a
commit c14243913d

70
snamellit/packages/uv.scm Normal file
View file

@ -0,0 +1,70 @@
(define-module (snamellit packages uv)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system copy)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages gcc)
#:use-module (gnu packages base)
#:use-module (gnu packages elf)
#:use-module (guix licenses))
;; found at https://git.sr.ht/~alex-iam/alex-guix-channel/tree/master/item/alex/packages/uv.scm
(define-public uv
(package
(name "uv")
(version "0.8.2")
(source
(origin
(method url-fetch)
(uri (string-append
"https://github.com/astral-sh/uv/releases/download/"
version
"/uv-x86_64-unknown-linux-gnu.tar.gz"))
(sha256
(base32 "1bdhi34cwc051xqxp8h5hs4bzmix52hx9s5jxxd4b2l686jjijvd"))))
(build-system copy-build-system)
(inputs
`(("gcc:lib" ,gcc "lib")
("glibc" ,glibc)))
(native-inputs (list patchelf))
(arguments
`(#:install-plan
'(("uv" "bin/")
("uvx" "bin/"))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'make-executables
(lambda _
(for-each make-file-writable '("uv" "uvx"))
#t))
(add-after 'install 'patch-runpath
(lambda* (#:key outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(gcc-lib (assoc-ref inputs "gcc:lib"))
(libgcc-path (string-append gcc-lib "/lib/libgcc_s.so.1"))
(glibc (assoc-ref inputs "glibc"))
(glibc-lib (string-append glibc "/lib"))
(dynamic-linker (string-append glibc-lib "/ld-linux-x86-64.so.2")))
(for-each
(lambda (exe)
(invoke "patchelf"
"--set-interpreter" dynamic-linker
(string-append bin "/" exe))
(invoke "patchelf"
"--set-rpath"
(string-append gcc-lib "/lib:" glibc-lib)
(string-append bin "/" exe)))
'("uv" "uvx"))
#t))))))
(synopsis "Fast Python package manager (prebuilt binary)")
(description
"uv is a fast and unified Python package manager, written in Rust. This version installs the official prebuilt binaries.")
(home-page "https://astral.sh/uv")
(license expat)))
uv