about summary refs log tree commit diff
path: root/src/nix/installables.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-23T15·11+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-23T15·11+0200
commitd74236d1f2c3bca4fcc8cb1574fb962e813f69d3 (patch)
tree0ec4d387e04e9a79835efebd85753aeb5a00d251 /src/nix/installables.hh
parent22d6e31fc6a9de2ee424984e629ccd2e394ba512 (diff)
nix build: Use Nix search path
That is, unless --file is specified, the Nix search path is
synthesized into an attribute set. Thus you can say

  $ nix build nixpkgs.hello

assuming $NIX_PATH contains an entry of the form "nixpkgs=...". This
is more verbose than

  $ nix build hello

but is less ambiguous.
Diffstat (limited to 'src/nix/installables.hh')
-rw-r--r--src/nix/installables.hh12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nix/installables.hh b/src/nix/installables.hh
index 5eb897d46148..a58f7dc59bb4 100644
--- a/src/nix/installables.hh
+++ b/src/nix/installables.hh
@@ -21,10 +21,13 @@ struct UserEnvElem
 
 typedef std::vector<UserEnvElem> UserEnvElems;
 
+struct Value;
+class EvalState;
+
 struct MixInstallables : virtual Args
 {
     Strings installables;
-    Path file = "<nixpkgs>";
+    Path file;
 
     MixInstallables()
     {
@@ -33,6 +36,13 @@ struct MixInstallables : virtual Args
     }
 
     UserEnvElems evalInstallables(ref<Store> store);
+
+    /* Return a value representing the Nix expression from which we
+       are installing. This is either the file specified by ‘--file’,
+       or an attribute set constructed from $NIX_PATH, e.g. ‘{ nixpkgs
+       = import ...; bla = import ...; }’. */
+    Value * buildSourceExpr(EvalState & state);
+
 };
 
 }