Browse Source

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.
gn-latest-20200428
Ludovic Courtès 9 years ago
parent
commit
900f726734
2 changed files with 21 additions and 6 deletions
  1. +6
    -5
      guix/build-system/gnu.scm
  2. +15
    -1
      guix/utils.scm

+ 6
- 5
guix/build-system/gnu.scm View File

@ -33,11 +33,12 @@
;; Code:
(define %standard-inputs
(map (lambda (name)
(list name (nixpkgs-derivation name)))
'("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
"coreutils" "gnused" "gnugrep" "bash"
"gcc" "binutils" "gnumake" "glibc")))
(compile-time-value
(map (lambda (name)
(list name (nixpkgs-derivation name)))
'("gnutar" "gzip" "bzip2" "xz" "diffutils" "patch"
"coreutils" "gnused" "gnugrep" "bash"
"gcc" "binutils" "gnumake" "glibc"))))
(define* (gnu-build store name source inputs
#:key (outputs '("out")) (configure-flags ''())


+ 15
- 1
guix/utils.scm View File

@ -45,6 +45,7 @@
nixpkgs-derivation
define-record-type*
compile-time-value
memoize
gnu-triplet->nix-system
%current-system))
@ -376,8 +377,21 @@ starting from the right of S."
;;; 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
(make-parameter (getenv "NIXPKGS")))
(make-parameter
;; Capture the build-time value of $NIXPKGS.
(compile-time-value (getenv "NIXPKGS"))))
(define (nixpkgs-derivation attribute)
"Return the derivation path of ATTRIBUTE in Nixpkgs."


Loading…
Cancel
Save