diff options
author | Shea Levy <shea@shealevy.com> | 2015-07-23 09:34:06 -0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-23 17:03:47 +0200 |
commit | 1ed55234d9efce7d40c97ef1215090015d18498c (patch) | |
tree | 23ebb9e5716a68f3437ad4e41cb852d217dd3040 /src/libexpr | |
parent | 61af14a9219bff090b238f15c9def5453087aa5d (diff) |
Allow derivations-as-srcs in the context of builtins.toFile files
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 6a4b5b042..f555de73e 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -872,8 +872,12 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu for (auto path : context) { if (path.at(0) == '=') path = string(path, 1); - if (isDerivation(path)) - throw EvalError(format("in ‘toFile’: the file ‘%1%’ cannot refer to derivation outputs, at %2%") % name % pos); + if (isDerivation(path)) { + /* See prim_unsafeDiscardOutputDependency. */ + if (path.at(0) != '~') + throw EvalError(format("in ‘toFile’: the file ‘%1%’ cannot refer to derivation outputs, at %2%") % name % pos); + path = string(path, 1); + } refs.insert(path); } |