diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-06-28 22:38:09 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-06-28 22:38:09 +0200 |
commit | 900f7267341da3281e937cb0b128b21975574867 (patch) | |
tree | 4c87f62a5a0c7a49d05b9776ec7668a4800450f9 /guix/utils.scm | |
parent | e3ce5d709f3ba6a3f3a94a24c20a9cd87e6bd07d (diff) | |
download | gnu-guix-900f7267341da3281e937cb0b128b21975574867.tar gnu-guix-900f7267341da3281e937cb0b128b21975574867.tar.gz |
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.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r-- | guix/utils.scm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/guix/utils.scm b/guix/utils.scm index 05c04b87f1..bcea0193d0 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -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." |