aboutsummaryrefslogtreecommitdiff
path: root/guix/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-28 18:05:17 +0100
committerLudovic Courtès <ludo@gnu.org>2014-10-29 00:31:23 +0100
commitfc93e309196ee8009a975b4c0acf712f54581a93 (patch)
treecea95d0312fc5e37bb3fc1a084868ad160d1e857 /guix/derivations.scm
parent31a123fe00731a9479e8f11baefeb371ff538cd8 (diff)
downloadgnu-guix-fc93e309196ee8009a975b4c0acf712f54581a93.tar
gnu-guix-fc93e309196ee8009a975b4c0acf712f54581a93.tar.gz
derivations: Add 'offloadable-derivation?' and 'substitutable-derivation?'.
* guix/derivations.scm (offloadable-derivation?, substitutable-derivation?): New procedures. * tests/derivations.scm ("offloadable-derivation?"): New test.
Diffstat (limited to 'guix/derivations.scm')
-rw-r--r--guix/derivations.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index ae9d2f46c7..5a8cc2c57a 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -57,6 +57,8 @@
derivation-input-output-paths
fixed-output-derivation?
+ offloadable-derivation?
+ substitutable-derivation?
derivation-hash
read-derivation
@@ -156,6 +158,18 @@ download with a fixed hash (aka. `fetchurl')."
read-derivation))
inputs)))))
+(define (offloadable-derivation? drv)
+ "Return true if DRV can be offloaded, false otherwise."
+ (match (assoc "preferLocalBuild"
+ (derivation-builder-environment-vars drv))
+ (("preferLocalBuild" . "1") #f)
+ (_ #t)))
+
+(define substitutable-derivation?
+ ;; Return #t if the derivation can be substituted. Currently the two are
+ ;; synonymous, see <http://bugs.gnu.org/18747>.
+ offloadable-derivation?)
+
(define* (derivation-prerequisites-to-build store drv
#:key
(outputs