summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-04-30 23:51:44 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-01 00:06:17 +0200
commitc04681554da812f4ce1bed87c601cd62c663d151 (patch)
tree159f4fd6f0953f18357c38846ecbcd8eda3513aa
parentd17551d9438c6fe5c9bc3674e39345f15dc0c0ac (diff)
derivations: Add #:leaked-env-vars parameter.
Suggested by Joshua Randall <jcrandall@alum.mit.edu> in <http://bugs.gnu.org/20402>. * guix/derivations.scm (derivation): Add #:leaked-env-vars parameter. [user+system-env-vars]: Honor it. * guix/gexp.scm (gexp->derivation): Add #:leaked-env-vars and pass it to 'raw-derivation'. * doc/guix.texi (Derivations, G-Expressions): Adjust accordingly.
-rw-r--r--doc/guix.texi10
-rw-r--r--guix/derivations.scm12
-rw-r--r--guix/gexp.scm2
3 files changed, 22 insertions, 2 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 4269d4fa5ff..dd6af809654 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2187,7 +2187,7 @@ a derivation is the @code{derivation} procedure:
2187 @var{args} [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @ 2187 @var{args} [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @
2188 [#:recursive? #f] [#:inputs '()] [#:env-vars '()] @ 2188 [#:recursive? #f] [#:inputs '()] [#:env-vars '()] @
2189 [#:system (%current-system)] [#:references-graphs #f] @ 2189 [#:system (%current-system)] [#:references-graphs #f] @
2190 [#:allowed-references #f] [#:local-build? #f] 2190 [#:allowed-references #f] [#:leaked-env-vars #f] [#:local-build? #f]
2191Build a derivation with the given arguments, and return the resulting 2191Build a derivation with the given arguments, and return the resulting
2192@code{<derivation>} object. 2192@code{<derivation>} object.
2193 2193
@@ -2206,6 +2206,13 @@ a simple text format.
2206When @var{allowed-references} is true, it must be a list of store items 2206When @var{allowed-references} is true, it must be a list of store items
2207or outputs that the derivation's output may refer to. 2207or outputs that the derivation's output may refer to.
2208 2208
2209When @var{leaked-env-vars} is true, it must be a list of strings
2210denoting environment variables that are allowed to ``leak'' from the
2211daemon's environment to the build environment. This is only applicable
2212to fixed-output derivations---i.e., when @var{hash} is true. The main
2213use is to allow variables such as @code{http_proxy} to be passed to
2214derivations that download files.
2215
2209When @var{local-build?} is true, declare that the derivation is not a 2216When @var{local-build?} is true, declare that the derivation is not a
2210good candidate for offloading and should rather be built locally 2217good candidate for offloading and should rather be built locally
2211(@pxref{Daemon Offload Setup}). This is the case for small derivations 2218(@pxref{Daemon Offload Setup}). This is the case for small derivations
@@ -2728,6 +2735,7 @@ information about monads.)
2728 [#:recursive? #f] [#:env-vars '()] [#:modules '()] @ 2735 [#:recursive? #f] [#:env-vars '()] [#:modules '()] @
2729 [#:module-path @var{%load-path}] @ 2736 [#:module-path @var{%load-path}] @
2730 [#:references-graphs #f] [#:allowed-references #f] @ 2737 [#:references-graphs #f] [#:allowed-references #f] @
2738 [#:leaked-env-vars #f] @
2731 [#:local-build? #f] [#:guile-for-build #f] 2739 [#:local-build? #f] [#:guile-for-build #f]
2732Return a derivation @var{name} that runs @var{exp} (a gexp) with 2740Return a derivation @var{name} that runs @var{exp} (a gexp) with
2733@var{guile-for-build} (a derivation) on @var{system}. When @var{target} 2741@var{guile-for-build} (a derivation) on @var{system}. When @var{target}
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 7737e39b2d6..1056caa70a7 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -692,7 +692,7 @@ HASH-ALGO, of the derivation NAME. RECURSIVE? has the same meaning as for
692 (inputs '()) (outputs '("out")) 692 (inputs '()) (outputs '("out"))
693 hash hash-algo recursive? 693 hash hash-algo recursive?
694 references-graphs allowed-references 694 references-graphs allowed-references
695 local-build?) 695 leaked-env-vars local-build?)
696 "Build a derivation with the given arguments, and return the resulting 696 "Build a derivation with the given arguments, and return the resulting
697<derivation> object. When HASH and HASH-ALGO are given, a 697<derivation> object. When HASH and HASH-ALGO are given, a
698fixed-output derivation is created---i.e., one whose result is known in 698fixed-output derivation is created---i.e., one whose result is known in
@@ -707,6 +707,12 @@ the build environment in the corresponding file, in a simple text format.
707When ALLOWED-REFERENCES is true, it must be a list of store items or outputs 707When ALLOWED-REFERENCES is true, it must be a list of store items or outputs
708that the derivation's output may refer to. 708that the derivation's output may refer to.
709 709
710When LEAKED-ENV-VARS is true, it must be a list of strings denoting
711environment variables that are allowed to \"leak\" from the daemon's
712environment to the build environment. This is only applicable to fixed-output
713derivations--i.e., when HASH is true. The main use is to allow variables such
714as \"http_proxy\" to be passed to derivations that download files.
715
710When LOCAL-BUILD? is true, declare that the derivation is not a good candidate 716When LOCAL-BUILD? is true, declare that the derivation is not a good candidate
711for offloading and should rather be built locally. This is the case for small 717for offloading and should rather be built locally. This is the case for small
712derivations where the costs of data transfers would outweigh the benefits." 718derivations where the costs of data transfers would outweigh the benefits."
@@ -751,6 +757,10 @@ derivations where the costs of data transfers would outweigh the benefits."
751 `(("allowedReferences" 757 `(("allowedReferences"
752 . ,(string-join allowed-references))) 758 . ,(string-join allowed-references)))
753 '()) 759 '())
760 ,@(if leaked-env-vars
761 `(("impureEnvVars"
762 . ,(string-join leaked-env-vars)))
763 '())
754 ,@env-vars))) 764 ,@env-vars)))
755 (match references-graphs 765 (match references-graphs
756 (((file . path) ...) 766 (((file . path) ...)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index a2da72e76c0..b08a3612323 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -282,6 +282,7 @@ names and file names suitable for the #:allowed-references argument to
282 (graft? (%graft?)) 282 (graft? (%graft?))
283 references-graphs 283 references-graphs
284 allowed-references 284 allowed-references
285 leaked-env-vars
285 local-build?) 286 local-build?)
286 "Return a derivation NAME that runs EXP (a gexp) with GUILE-FOR-BUILD (a 287 "Return a derivation NAME that runs EXP (a gexp) with GUILE-FOR-BUILD (a
287derivation) on SYSTEM. When TARGET is true, it is used as the 288derivation) on SYSTEM. When TARGET is true, it is used as the
@@ -400,6 +401,7 @@ The other arguments are as for 'derivation'."
400 #:hash hash #:hash-algo hash-algo #:recursive? recursive? 401 #:hash hash #:hash-algo hash-algo #:recursive? recursive?
401 #:references-graphs (and=> graphs graphs-file-names) 402 #:references-graphs (and=> graphs graphs-file-names)
402 #:allowed-references allowed 403 #:allowed-references allowed
404 #:leaked-env-vars leaked-env-vars
403 #:local-build? local-build?)))) 405 #:local-build? local-build?))))
404 406
405(define* (gexp-inputs exp #:key native?) 407(define* (gexp-inputs exp #:key native?)