rosenthal: alloy-bin: Use ‘binary-package’.

This commit is contained in:
Hilton Chain 2026-02-13 15:23:42 +08:00
parent 2db419232a
commit 9f069f714d
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292

View File

@ -11,6 +11,7 @@
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix platform)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (rosenthal utils packages) #:use-module (rosenthal utils packages)
;; Guix origin methods ;; Guix origin methods
@ -483,76 +484,67 @@ rather a set of labels for each log stream.")
"1pxnjzygm2mylipf6cjkqxm4k3i9vnm7v80avxbhv8400p3aszqk")))))) "1pxnjzygm2mylipf6cjkqxm4k3i9vnm7v80avxbhv8400p3aszqk"))))))
(define-public alloy-bin (define-public alloy-bin
(package (binary-package
(name "alloy-bin") `(("x86_64-linux" . ,%alloy-source-x86_64-linux)
(version (package-version %alloy-source-x86_64-linux)) ("aarch64-linux" . ,%alloy-source-aarch64-linux))
(source #f) (package
(build-system copy-build-system) (name "alloy-bin")
(arguments (version "")
(let ((binary-source (source #f)
(match (or (%current-target-system) (build-system copy-build-system)
(%current-system)) (arguments
((? target-aarch64?) (list
(package-source %alloy-source-aarch64-linux)) #:install-plan
(_ (match (or (and=> (%current-target-system) platform-target->system)
(package-source %alloy-source-x86_64-linux))))) (%current-system))
(list ("aarch64-linux"
#:install-plan #~'(("alloy-linux-arm64" "bin/alloy")))
(match (or (%current-target-system) (_
(%current-system)) #~'(("alloy-linux-amd64" "bin/alloy"))))
((? target-aarch64?) #:modules
#~'(("alloy-linux-arm64" "bin/alloy"))) '((ice-9 match)
(_ (guix build copy-build-system)
#~'(("alloy-linux-amd64" "bin/alloy")))) (guix build utils))
#:modules #:phases
'((ice-9 match) #~(modify-phases %standard-phases
(guix build copy-build-system) (add-after 'install 'patch-elf
(guix build utils)) (lambda _
#:phases (let ((name "alloy")
#~(modify-phases %standard-phases (dest (in-vicinity #$output "bin"))
(replace 'unpack (ld.so #$(file-append glibc (glibc-dynamic-linker))))
(lambda _ (with-directory-excursion dest
((assoc-ref %standard-phases 'unpack) (invoke "patchelf" "--set-interpreter" ld.so name)
#:source #+binary-source))) (chmod name #o555)))))
(add-after 'install 'patch-elf (add-after 'patch-elf 'install-extras
(lambda _ (lambda* (#:key native-inputs inputs #:allow-other-keys)
(let ((name "alloy") (let ((alloy
(dest (in-vicinity #$output "bin")) (if #$(%current-target-system)
(ld.so #$(file-append glibc (glibc-dynamic-linker)))) (search-input-file (or native-inputs inputs)
(with-directory-excursion dest "bin/alloy")
(invoke "patchelf" "--set-interpreter" ld.so name) (in-vicinity #$output "bin/alloy"))))
(chmod name #o555))))) (for-each
(add-after 'patch-elf 'install-extras (match-lambda
(lambda* (#:key native-inputs inputs #:allow-other-keys) ((shell . file)
(let ((alloy (mkdir-p (in-vicinity #$output (dirname file)))
(if #$(%current-target-system) (with-output-to-file (in-vicinity #$output file)
(search-input-file (or native-inputs inputs) (lambda ()
"bin/alloy") (invoke alloy "completion" shell)))))
(in-vicinity #$output "bin/alloy")))) '(("bash" . "share/bash-completion/completions/alloy")
(for-each ("fish" . "share/fish/vendor_completions.d/alloy.fish")
(match-lambda ("zsh" . "share/zsh/site-functions/_alloy")))))))))
((shell . file) (native-inputs
(mkdir-p (in-vicinity #$output (dirname file))) (append (if (%current-target-system)
(with-output-to-file (in-vicinity #$output file) (list this-package)
(lambda () '())
(invoke alloy "completion" shell))))) (list patchelf unzip)))
'(("bash" . "share/bash-completion/completions/alloy") (supported-systems '("x86_64-linux" "aarch64-linux"))
("fish" . "share/fish/vendor_completions.d/alloy.fish") (home-page "https://grafana.com/oss/alloy-opentelemetry-collector/")
("zsh" . "share/zsh/site-functions/_alloy")))))))))) (synopsis
(native-inputs "OpenTelemetry Collector distribution with programmable pipelines")
(append (if (%current-target-system) (description
(list this-package) "Grafana Alloy is an open source OpenTelemetry Collector distribution with
'())
(list patchelf unzip)))
(supported-systems '("x86_64-linux" "aarch64-linux"))
(home-page "https://grafana.com/oss/alloy-opentelemetry-collector/")
(synopsis
"OpenTelemetry Collector distribution with programmable pipelines")
(description
"Grafana Alloy is an open source OpenTelemetry Collector distribution with
built-in Prometheus pipelines and support for metrics, logs, traces, and built-in Prometheus pipelines and support for metrics, logs, traces, and
profiles.") profiles.")
(license license:agpl3) (license license:agpl3))))
(properties '((disable-updater? . #t)))))
(define-deprecated-package alloy-bin-aarch64-linux alloy-bin) (define-deprecated-package alloy-bin-aarch64-linux alloy-bin)