summaryrefslogtreecommitdiff
path: root/guix/search-paths.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-05 15:02:35 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-05 15:13:59 +0200
commit8e3a3bc290cf5de266979fdf9abb87891de4f0ab (patch)
tree98f241f10b9ac43baa4f839f100fa8c1d0ead840 /guix/search-paths.scm
parentb9ea6c6bf4948fd15876c915febad430e3177e42 (diff)
downloadgnu-guix-8e3a3bc290cf5de266979fdf9abb87891de4f0ab.tar
gnu-guix-8e3a3bc290cf5de266979fdf9abb87891de4f0ab.tar.gz
environment: Move iteration outside of 'for-each-search-path'.
* guix/search-paths.scm (search-path-definition): New procedure. * guix/scripts/environment.scm (for-each-search-path): Rename to... (evaluate-input-search-paths): ... this. Remove 'proc' and 'pure?' parameters, and return directly the list of search-path/value pairs. (create-environment): Use 'for-each' and 'evaluate-input-search-paths' instead of 'for-each-search-path'. (show-search-paths): Use 'for-each', 'search-path-definition', and 'evaluate-search-paths' instead of 'for-each-search-path'.
Diffstat (limited to 'guix/search-paths.scm')
-rw-r--r--guix/search-paths.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/guix/search-paths.scm b/guix/search-paths.scm
index 89af1e1492..ee7e9a131f 100644
--- a/guix/search-paths.scm
+++ b/guix/search-paths.scm
@@ -36,7 +36,8 @@
search-path-specification->sexp
sexp->search-path-specification
evaluate-search-paths
- environment-variable-definition))
+ environment-variable-definition
+ search-path-definition))
;;; Commentary:
;;;
@@ -160,7 +161,7 @@ report only settings not already effective."
#:key
(kind 'exact)
(separator ":"))
- "Return a the definition of VARIABLE to VALUE in Bash syntax:
+ "Return a the definition of VARIABLE to VALUE in Bash syntax.
KIND can be either 'exact (return the definition of VARIABLE=VALUE),
'prefix (return the definition where VALUE is added as a prefix to VARIABLE's
@@ -178,4 +179,14 @@ prefix/suffix."
(format #f "export ~a=\"$~a${~a:+~a}~a\""
variable variable variable separator value))))
+(define* (search-path-definition search-path value
+ #:key (kind 'exact))
+ "Similar to 'environment-variable-definition', but applied to a
+<search-path-specification>."
+ (match search-path
+ (($ <search-path-specification> variable _ separator)
+ (environment-variable-definition variable value
+ #:kind kind
+ #:separator separator))))
+
;;; search-paths.scm ends here