Add basic "nix build" command

Currently only builds by attribute from <nixpkgs> or the specified
file, e.g. "nix build hello".
This commit is contained in:
Eelco Dolstra 2016-02-09 21:34:24 +01:00
parent cd2196b089
commit 206bbb5dc9
3 changed files with 159 additions and 0 deletions

38
src/nix/installables.hh Normal file
View file

@ -0,0 +1,38 @@
#pragma once
#include "args.hh"
namespace nix {
struct UserEnvElem
{
Strings attrPath;
// FIXME: should use boost::variant or so.
bool isDrv;
// Derivation case:
Path drvPath;
StringSet outputNames;
// Non-derivation case:
PathSet outPaths;
};
typedef std::vector<UserEnvElem> UserEnvElems;
struct MixInstallables : virtual Args
{
Strings installables;
Path file = "<nixpkgs>";
MixInstallables()
{
mkFlag('f', "file", "file", "evaluate FILE rather than the default", &file);
expectArgs("installables", &installables);
}
UserEnvElems evalInstallables(ref<Store> store);
};
}