about summary refs log tree commit diff
path: root/src/nix-build/nix-build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-build/nix-build.cc')
-rwxr-xr-xsrc/nix-build/nix-build.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 21b0a18dd887..58366daa6e86 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -263,6 +263,8 @@ void mainWrapped(int argc, char * * argv)
     if (runEnv)
         setenv("IN_NIX_SHELL", pure ? "pure" : "impure", 1);
 
+    DrvInfos drvs;
+
     /* Parse the expressions. */
     std::vector<Expr *> exprs;
 
@@ -272,6 +274,8 @@ void mainWrapped(int argc, char * * argv)
         for (auto i : left) {
             if (fromArgs)
                 exprs.push_back(state.parseExprFromString(i, absPath(".")));
+            else if (store->isStorePath(i) && std::regex_match(i, std::regex(".*\\.drv(!.*)?")))
+                drvs.push_back(DrvInfo(state, store, i));
             else
                 /* If we're in a #! script, interpret filenames
                    relative to the script. */
@@ -280,8 +284,6 @@ void mainWrapped(int argc, char * * argv)
         }
 
     /* Evaluate them into derivations. */
-    DrvInfos drvs;
-
     if (attrPaths.empty()) attrPaths = {""};
 
     for (auto e : exprs) {