Introduce `compile-time-value' and use it.
* guix/utils.scm (compile-time-value): New macro. (%nixpkgs-directory): Use it. * guix/build-system/gnu.scm (%standard-inputs): Likewise.
This commit is contained in:
parent
e3ce5d709f
commit
900f726734
|
@ -33,11 +33,12 @@
|
||||||
;; Code:
|
;; Code:
|
||||||
|
|
||||||
(define %standard-inputs
|
(define %standard-inputs
|
||||||
(map (lambda (name)
|
(compile-time-value
|
||||||
(list name (nixpkgs-derivation name)))
|
(map (lambda (name)
|
||||||
'("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
|
(list name (nixpkgs-derivation name)))
|
||||||
"coreutils" "gnused" "gnugrep" "bash"
|
'("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
|
||||||
"gcc" "binutils" "gnumake" "glibc")))
|
"coreutils" "gnused" "gnugrep" "bash"
|
||||||
|
"gcc" "binutils" "gnumake" "glibc"))))
|
||||||
|
|
||||||
(define* (gnu-build store name source inputs
|
(define* (gnu-build store name source inputs
|
||||||
#:key (outputs '("out")) (configure-flags ''())
|
#:key (outputs '("out")) (configure-flags ''())
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
nixpkgs-derivation
|
nixpkgs-derivation
|
||||||
|
|
||||||
define-record-type*
|
define-record-type*
|
||||||
|
compile-time-value
|
||||||
memoize
|
memoize
|
||||||
gnu-triplet->nix-system
|
gnu-triplet->nix-system
|
||||||
%current-system))
|
%current-system))
|
||||||
|
@ -376,8 +377,21 @@ starting from the right of S."
|
||||||
;;; Nixpkgs.
|
;;; Nixpkgs.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
(define-syntax compile-time-value
|
||||||
|
(syntax-rules ()
|
||||||
|
"Evaluate the given expression at compile time. The expression must
|
||||||
|
evaluate to a simple datum."
|
||||||
|
((_ exp)
|
||||||
|
(let-syntax ((v (lambda (s)
|
||||||
|
(let ((val exp))
|
||||||
|
(syntax-case s ()
|
||||||
|
(_ #`'#,(datum->syntax s val)))))))
|
||||||
|
v))))
|
||||||
|
|
||||||
(define %nixpkgs-directory
|
(define %nixpkgs-directory
|
||||||
(make-parameter (getenv "NIXPKGS")))
|
(make-parameter
|
||||||
|
;; Capture the build-time value of $NIXPKGS.
|
||||||
|
(compile-time-value (getenv "NIXPKGS"))))
|
||||||
|
|
||||||
(define (nixpkgs-derivation attribute)
|
(define (nixpkgs-derivation attribute)
|
||||||
"Return the derivation path of ATTRIBUTE in Nixpkgs."
|
"Return the derivation path of ATTRIBUTE in Nixpkgs."
|
||||||
|
|
Loading…
Reference in New Issue