Move code around

This commit is contained in:
Eelco Dolstra
2019-10-14 14:40:16 +02:00
parent 5446eae949
commit 0bc8f1669d
3 changed files with 216 additions and 189 deletions
+2 -47
View File
@@ -1,15 +1,15 @@
#pragma once
#include "installables.hh"
#include "args.hh"
#include "common-eval-args.hh"
#include <optional>
namespace nix {
extern std::string programPath;
struct Value;
class Bindings;
class EvalState;
class Store;
@@ -30,51 +30,6 @@ private:
std::shared_ptr<Store> _store;
};
struct Buildable
{
Path drvPath; // may be empty
std::map<std::string, Path> outputs;
};
typedef std::vector<Buildable> Buildables;
struct App
{
PathSet context;
Path program;
// FIXME: add args, sandbox settings, metadata, ...
App(EvalState & state, Value & vApp);
};
struct Installable
{
virtual ~Installable() { }
virtual std::string what() = 0;
virtual Buildables toBuildables()
{
throw Error("argument '%s' cannot be built", what());
}
Buildable toBuildable();
App toApp(EvalState & state);
virtual Value * toValue(EvalState & state)
{
throw Error("argument '%s' cannot be evaluated", what());
}
/* Return a value only if this installable is a store path or a
symlink to it. */
virtual std::optional<Path> getStorePath()
{
return {};
}
};
struct EvalCommand : virtual StoreCommand, MixEvalArgs
{
ref<EvalState> getEvalState();