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.master
parent
dd01fecd23
commit
f073e52382
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; 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.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -27,7 +27,6 @@
|
||||||
%guix-register-program
|
%guix-register-program
|
||||||
%system
|
%system
|
||||||
%libgcrypt
|
%libgcrypt
|
||||||
%nixpkgs
|
|
||||||
%nix-instantiate
|
%nix-instantiate
|
||||||
%gzip
|
%gzip
|
||||||
%bzip2
|
%bzip2
|
||||||
|
@ -73,11 +72,6 @@
|
||||||
(define %libgcrypt
|
(define %libgcrypt
|
||||||
"@LIBGCRYPT@")
|
"@LIBGCRYPT@")
|
||||||
|
|
||||||
(define %nixpkgs
|
|
||||||
(if (string=? "@NIXPKGS@" "")
|
|
||||||
#f
|
|
||||||
"@NIXPKGS@"))
|
|
||||||
|
|
||||||
(define %nix-instantiate
|
(define %nix-instantiate
|
||||||
"@NIX_INSTANTIATE@")
|
"@NIX_INSTANTIATE@")
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,6 @@
|
||||||
#:export (bytevector->base16-string
|
#:export (bytevector->base16-string
|
||||||
base16-string->bytevector
|
base16-string->bytevector
|
||||||
|
|
||||||
%nixpkgs-directory
|
|
||||||
nixpkgs-derivation
|
|
||||||
nixpkgs-derivation*
|
|
||||||
|
|
||||||
compile-time-value
|
compile-time-value
|
||||||
fcntl-flock
|
fcntl-flock
|
||||||
memoize
|
memoize
|
||||||
|
@ -314,40 +310,6 @@ a list of command-line arguments passed to the compression program."
|
||||||
(unless (every (compose zero? cdr waitpid) pids)
|
(unless (every (compose zero? cdr waitpid) pids)
|
||||||
(error "compressed-output-port failure" pids))))))
|
(error "compressed-output-port failure" pids))))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
|
||||||
;;; 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.
|
;;; Advisory file locking.
|
||||||
|
|
|
@ -84,11 +84,14 @@ then
|
||||||
# Place for the substituter's cache.
|
# Place for the substituter's cache.
|
||||||
XDG_CACHE_HOME="$NIX_STATE_DIR/cache-$$"
|
XDG_CACHE_HOME="$NIX_STATE_DIR/cache-$$"
|
||||||
|
|
||||||
|
# For the (guix import snix) tests.
|
||||||
|
NIXPKGS="@NIXPKGS@"
|
||||||
|
|
||||||
export NIX_IGNORE_SYMLINK_STORE NIX_STORE_DIR \
|
export NIX_IGNORE_SYMLINK_STORE NIX_STORE_DIR \
|
||||||
NIX_LOCALSTATE_DIR NIX_LOG_DIR NIX_STATE_DIR NIX_DB_DIR \
|
NIX_LOCALSTATE_DIR NIX_LOG_DIR NIX_STATE_DIR NIX_DB_DIR \
|
||||||
NIX_ROOT_FINDER NIX_SETUID_HELPER GUIX_BINARY_SUBSTITUTE_URL \
|
NIX_ROOT_FINDER NIX_SETUID_HELPER GUIX_BINARY_SUBSTITUTE_URL \
|
||||||
GUIX_ALLOW_UNAUTHENTICATED_SUBSTITUTES \
|
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
|
# Launch the daemon without chroot support because is may be
|
||||||
# unavailable, for instance if we're not running as root.
|
# unavailable, for instance if we're not running as root.
|
||||||
|
|
|
@ -476,8 +476,7 @@
|
||||||
(define %coreutils
|
(define %coreutils
|
||||||
(false-if-exception
|
(false-if-exception
|
||||||
(and (network-reachable?)
|
(and (network-reachable?)
|
||||||
(or (package-derivation %store %bootstrap-coreutils&co)
|
(package-derivation %store %bootstrap-coreutils&co))))
|
||||||
(nixpkgs-derivation "coreutils")))))
|
|
||||||
|
|
||||||
(test-skip (if %coreutils 0 1))
|
(test-skip (if %coreutils 0 1))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; 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.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -18,11 +18,13 @@
|
||||||
|
|
||||||
(define-module (test-snix)
|
(define-module (test-snix)
|
||||||
#:use-module (guix import snix)
|
#:use-module (guix import snix)
|
||||||
#:use-module ((guix utils) #:select (%nixpkgs-directory))
|
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-64)
|
#:use-module (srfi srfi-64)
|
||||||
#:use-module (ice-9 match))
|
#:use-module (ice-9 match))
|
||||||
|
|
||||||
|
(define %nixpkgs-directory
|
||||||
|
(getenv "NIXPKGS"))
|
||||||
|
|
||||||
(define factorize-uri
|
(define factorize-uri
|
||||||
(@@ (guix import snix) 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/2.8/foo-2.8.tgz" "2.8"
|
||||||
-> ("http://example.com/" version "/foo-" version ".tgz")))))
|
-> ("http://example.com/" version "/foo-" version ".tgz")))))
|
||||||
|
|
||||||
(test-skip (if (and (%nixpkgs-directory)
|
(test-skip (if (and %nixpkgs-directory
|
||||||
(file-exists? (string-append (%nixpkgs-directory)
|
(file-exists? (string-append %nixpkgs-directory
|
||||||
"/default.nix")))
|
"/default.nix")))
|
||||||
0
|
0
|
||||||
1))
|
1))
|
||||||
|
|
||||||
(test-assert "nixpkgs->guix-package"
|
(test-assert "nixpkgs->guix-package"
|
||||||
(match (nixpkgs->guix-package (%nixpkgs-directory) "guile")
|
(match (nixpkgs->guix-package %nixpkgs-directory "guile")
|
||||||
(('package
|
(('package
|
||||||
('name "guile")
|
('name "guile")
|
||||||
('version (? string?))
|
('version (? string?))
|
||||||
|
|
Reference in New Issue