mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2025-09-19 05:04:39 +00:00
utils: Add go-vendored-fetch.
* rosenthal/utils/download.scm: New file.
This commit is contained in:
parent
e2f1327b3b
commit
d87c76525a
50
rosenthal/utils/download.scm
Normal file
50
rosenthal/utils/download.scm
Normal file
@ -0,0 +1,50 @@
|
||||
;; 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)
|
||||
#:use-module (guix build-system go)
|
||||
#:export (go-vendored-fetch))
|
||||
|
||||
;; NOTE: This approach shouldn't be upstreamed.
|
||||
(define* (go-vendored-fetch src hash-algo hash
|
||||
#:optional name
|
||||
#:key (system (%current-system))
|
||||
(go
|
||||
(module-ref
|
||||
(resolve-interface '(gnu packages golang))
|
||||
;; Use latest Go in Guix.
|
||||
'go-1.23))
|
||||
(nss-certs
|
||||
(module-ref
|
||||
(resolve-interface '(gnu packages certs))
|
||||
'nss-certs)))
|
||||
(gexp->derivation
|
||||
(or name
|
||||
(string-append (origin-file-name src) "-vendored"))
|
||||
(with-imported-modules %default-gnu-imported-modules
|
||||
#~(begin
|
||||
(use-modules (guix build gnu-build-system)
|
||||
(guix build utils))
|
||||
(setenv "GOCACHE" "/tmp/go")
|
||||
(setenv "GOMODCACHE" "/tmp/gomod")
|
||||
(setenv "SSL_CERT_DIR" #+(file-append nss-certs "/etc/ssl/certs"))
|
||||
;; Support Unicode in file name.
|
||||
(setlocale LC_ALL "C.UTF-8")
|
||||
|
||||
((assoc-ref %standard-phases 'unpack) #:source #+src)
|
||||
(invoke #+(file-append go "/bin/go") "mod" "vendor")
|
||||
(copy-recursively "." #$output)))
|
||||
#:system system
|
||||
#:hash-algo hash-algo
|
||||
#:hash hash
|
||||
;; Is a directory.
|
||||
#:recursive? #t
|
||||
;; Honor the user's proxy and locale settings.
|
||||
#:leaked-env-vars '("http_proxy" "https_proxy"
|
||||
"LC_ALL" "LC_MESSAGES" "LANG"
|
||||
"COLUMNS")
|
||||
#:local-build? #t))
|
Loading…
Reference in New Issue
Block a user