Rosenthal/modules/rosenthal/utils/download.scm
Hilton Chain 9aa77c91b2
maint: Clean up compatibility layer.
* modules/rosenthal/packages/rust-crates.scm (crate-name->package-name)
(define-cargo-inputs, crate-source): Remove, as they are available in
(guix build-system cargo).
* modules/rosenthal/utils/cargo.scm (rosenthal-cargo-inputs): Define using
cargo-inputs.
* modules/rosenthal/utils/download.scm (go-mod-vendor): Stop accessing nss-certs
from (gnu packages certs) module.
2025-08-24 19:17:03 +08:00

47 lines
1.6 KiB
Scheme
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;;
;;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal utils download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:export (go-mod-vendor))
;;;
;;; go mod vendor based fetcher
;;;
(define* (go-mod-vendor #:key go)
(lambda* (src hash-algo hash #:optional name #:key (system (%current-system)))
(define nss-certs
(module-ref (resolve-interface '(gnu packages nss)) 'nss-certs))
(gexp->derivation
(or name "vendored-go-dependencies")
(with-imported-modules %default-gnu-imported-modules
#~(begin
(use-modules (guix build gnu-build-system)
(guix build utils))
;; Support Unicode in file name.
(setlocale LC_ALL "C.UTF-8")
;; For HTTPS support.
(setenv "SSL_CERT_DIR" #+(file-append nss-certs "/etc/ssl/certs"))
((assoc-ref %standard-phases 'unpack) #:source #+src)
(invoke #+(file-append go "/bin/go") "mod" "vendor")
(copy-recursively "vendor" #$output)))
#:system system
#:hash-algo hash-algo
#:hash hash
;; Is a directory.
#:recursive? #t
#:env-vars '(("GOCACHE" . "/tmp/go-cache")
("GOPATH" . "/tmp/go"))
;; Honor the user's proxy and locale settings.
#:leaked-env-vars '("GOPROXY"
"http_proxy" "https_proxy"
"LC_ALL" "LC_MESSAGES" "LANG"
"COLUMNS")
#:local-build? #t)))