diff options
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 03d36638d4b4..4f0a9f1bdbf5 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -125,14 +125,24 @@ static void processBinding(EvalState & state, Expr e, Derivation & drv, else if (matchPath(e, s)) { Path srcPath(canonPath(aterm2String(s))); - if (isDerivation(srcPath)) - throw Error(format("file names are not allowed to end in `%1%'") - % drvExtension); - Path dstPath(addToStore(srcPath)); - printMsg(lvlChatty, format("copied source `%1%' -> `%2%'") - % srcPath % dstPath); - drv.inputSrcs.insert(dstPath); - ss.push_back(dstPath); + + if (isStorePath(srcPath)) { + printMsg(lvlChatty, format("using store path `%1%' as source") + % srcPath); + drv.inputSrcs.insert(srcPath); + ss.push_back(srcPath); + } + + else { + if (isDerivation(srcPath)) + throw Error(format("file names are not allowed to end in `%1%'") + % drvExtension); + Path dstPath(addToStore(srcPath)); + printMsg(lvlChatty, format("copied source `%1%' -> `%2%'") + % srcPath % dstPath); + drv.inputSrcs.insert(dstPath); + ss.push_back(dstPath); + } } else if (matchList(e, es)) { |