diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-06-01 23:32:26 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-06-01 23:32:26 +0200 |
commit | b53be755e465be04dc05e9069178874cb9f1f44d (patch) | |
tree | ac203c60539f00266d98edd3e3aff1c787dbe599 /guix | |
parent | 5a6a3ba43a1830c712e29d09e341e3cf14aea507 (diff) |
derivations: Add #:allowed-references 'derivation' parameter.
* guix/derivations.scm (derivation): Add #:allowed-references
parameter.
[user+system-env-vars]: Honor it.
* tests/derivations.scm ("derivation #:allowed-references, ok",
"derivation #:allowed-references, not allowed",
"derivation #:allowed-references, self allowed",
"derivation #:allowed-references, self not allowed"): New tests.
* doc/guix.texi (Derivations): Document #:allowed-references.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/derivations.scm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index 09b7ec079e..8d0c9c08df 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -565,7 +565,7 @@ HASH-ALGO, of the derivation NAME. RECURSIVE? has the same meaning as for (system (%current-system)) (env-vars '()) (inputs '()) (outputs '("out")) hash hash-algo recursive? - references-graphs + references-graphs allowed-references local-build?) "Build a derivation with the given arguments, and return the resulting <derivation> object. When HASH and HASH-ALGO are given, a @@ -578,6 +578,9 @@ When REFERENCES-GRAPHS is true, it must be a list of file name/store path pairs. In that case, the reference graph of each store path is exported in the build environment in the corresponding file, in a simple text format. +When ALLOWED-REFERENCES is true, it must be a list of store items or outputs +that the derivation's output may refer to. + When LOCAL-BUILD? is true, declare that the derivation is not a good candidate for offloading and should rather be built locally. This is the case for small derivations where the costs of data transfers would outweigh the benefits." @@ -615,10 +618,14 @@ derivations where the costs of data transfers would outweigh the benefits." ;; Some options are passed to the build daemon via the env. vars of ;; derivations (urgh!). We hide that from our API, but here is the place ;; where we kludgify those options. - (let ((env-vars (if local-build? - `(("preferLocalBuild" . "1") - ,@env-vars) - env-vars))) + (let ((env-vars `(,@(if local-build? + `(("preferLocalBuild" . "1")) + '()) + ,@(if allowed-references + `(("allowedReferences" + . ,(string-join allowed-references))) + '()) + ,@env-vars))) (match references-graphs (((file . path) ...) (let ((value (map (cut string-append <> " " <>) |