diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-10-06 22:33:03 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-10-06 23:51:04 +0200 |
commit | f073e52382d2ddcc638de73533bbf798f600d78a (patch) | |
tree | e51183c70aee2452d20c965feb515689da2dcb28 | |
parent | dd01fecd23a4ded46b99a51dc08ac5d964dbcd53 (diff) | |
download | patches-f073e52382d2ddcc638de73533bbf798f600d78a.tar patches-f073e52382d2ddcc638de73533bbf798f600d78a.tar.gz |
utils: Remove Nixpkgs helpers.
* guix/config.scm.in (%nixpkgs): Remove.
* guix/utils.scm (%nixpkgs-directory, nixpkgs-derivation,
nixpkgs-derivation*): Remove.
* test-env.in: Export 'NIXPKGS'.
* tests/derivations.scm (%coreutils): Remove use of
'nixpkgs-derivation'.
* tests/snix.scm (%nixpkgs-directory): New variable.
Adjust users accordingly.
-rw-r--r-- | guix/config.scm.in | 8 | ||||
-rw-r--r-- | guix/utils.scm | 38 | ||||
-rw-r--r-- | test-env.in | 5 | ||||
-rw-r--r-- | tests/derivations.scm | 3 | ||||
-rw-r--r-- | tests/snix.scm | 12 |
5 files changed, 13 insertions, 53 deletions
diff --git a/guix/config.scm.in b/guix/config.scm.in index eaadae9618..764e466bc5 100644 --- a/guix/config.scm.in +++ b/guix/config.scm.in @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,7 +27,6 @@ %guix-register-program %system %libgcrypt - %nixpkgs %nix-instantiate %gzip %bzip2 @@ -73,11 +72,6 @@ (define %libgcrypt "@LIBGCRYPT@") -(define %nixpkgs - (if (string=? "@NIXPKGS@" "") - #f - "@NIXPKGS@")) - (define %nix-instantiate "@NIX_INSTANTIATE@") diff --git a/guix/utils.scm b/guix/utils.scm index b6df5d9cc9..1d4b2ff9b0 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -44,10 +44,6 @@ #:export (bytevector->base16-string base16-string->bytevector - %nixpkgs-directory - nixpkgs-derivation - nixpkgs-derivation* - compile-time-value fcntl-flock memoize @@ -316,40 +312,6 @@ a list of command-line arguments passed to the compression program." ;;; -;;; Nixpkgs. -;;; - -(define %nixpkgs-directory - (make-parameter - ;; Capture the build-time value of $NIXPKGS. - (or %nixpkgs - (and=> (getenv "NIXPKGS") - (lambda (val) - ;; Bail out when passed an empty string, otherwise - ;; `nix-instantiate' will sit there and attempt to read - ;; from its standard input. - (if (string=? val "") - #f - val)))))) - -(define* (nixpkgs-derivation attribute #:optional (system (%current-system))) - "Return the derivation path of ATTRIBUTE in Nixpkgs." - (let* ((p (open-pipe* OPEN_READ (or (getenv "NIX_INSTANTIATE") - %nix-instantiate) - "-A" attribute (%nixpkgs-directory) - "--argstr" "system" system)) - (l (read-line p)) - (s (close-pipe p))) - (and (zero? (status:exit-val s)) - (not (eof-object? l)) - l))) - -(define-syntax-rule (nixpkgs-derivation* attribute) - "Evaluate the given Nixpkgs derivation at compile-time." - (compile-time-value (nixpkgs-derivation attribute))) - - -;;; ;;; Advisory file locking. ;;; diff --git a/test-env.in b/test-env.in index a7f506ec19..d6389a1097 100644 --- a/test-env.in +++ b/test-env.in @@ -84,11 +84,14 @@ then # Place for the substituter's cache. XDG_CACHE_HOME="$NIX_STATE_DIR/cache-$$" + # For the (guix import snix) tests. + NIXPKGS="@NIXPKGS@" + export NIX_IGNORE_SYMLINK_STORE NIX_STORE_DIR \ NIX_LOCALSTATE_DIR NIX_LOG_DIR NIX_STATE_DIR NIX_DB_DIR \ NIX_ROOT_FINDER NIX_SETUID_HELPER GUIX_BINARY_SUBSTITUTE_URL \ GUIX_ALLOW_UNAUTHENTICATED_SUBSTITUTES \ - NIX_CONF_DIR XDG_CACHE_HOME + NIX_CONF_DIR XDG_CACHE_HOME NIXPKGS # Launch the daemon without chroot support because is may be # unavailable, for instance if we're not running as root. diff --git a/tests/derivations.scm b/tests/derivations.scm index 21a832fabe..9fc96c71ae 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -476,8 +476,7 @@ (define %coreutils (false-if-exception (and (network-reachable?) - (or (package-derivation %store %bootstrap-coreutils&co) - (nixpkgs-derivation "coreutils"))))) + (package-derivation %store %bootstrap-coreutils&co)))) (test-skip (if %coreutils 0 1)) diff --git a/tests/snix.scm b/tests/snix.scm index 2318780d3d..a66b2c7b60 100644 --- a/tests/snix.scm +++ b/tests/snix.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,11 +18,13 @@ (define-module (test-snix) #:use-module (guix import snix) - #:use-module ((guix utils) #:select (%nixpkgs-directory)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) +(define %nixpkgs-directory + (getenv "NIXPKGS")) + (define factorize-uri (@@ (guix import snix) factorize-uri)) @@ -43,14 +45,14 @@ ("http://example.com/2.8/foo-2.8.tgz" "2.8" -> ("http://example.com/" version "/foo-" version ".tgz"))))) -(test-skip (if (and (%nixpkgs-directory) - (file-exists? (string-append (%nixpkgs-directory) +(test-skip (if (and %nixpkgs-directory + (file-exists? (string-append %nixpkgs-directory "/default.nix"))) 0 1)) (test-assert "nixpkgs->guix-package" - (match (nixpkgs->guix-package (%nixpkgs-directory) "guile") + (match (nixpkgs->guix-package %nixpkgs-directory "guile") (('package ('name "guile") ('version (? string?)) |