aboutsummaryrefslogtreecommitdiff
path: root/src/nix/installables.hh
diff options
context:
space:
mode:
authorCarlo Nucera <carlo.nucera@protonmail.com>2020-05-26 11:14:08 -0400
committerCarlo Nucera <carlo.nucera@protonmail.com>2020-05-26 11:14:08 -0400
commit6d73c100417c68a27a23194c78f1252ca511e250 (patch)
tree04eea8818b97d46fe28ade241069a3650f25a0c6 /src/nix/installables.hh
parent8aa46cd340c1294c3d06cd52f85c906bdf749070 (diff)
parent3d3c219d917525b0a131c4332dd65eadfc818f49 (diff)
Merge remote-tracking branch 'origin/master' into enum-FileIngestionMethod
Diffstat (limited to 'src/nix/installables.hh')
-rw-r--r--src/nix/installables.hh45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/nix/installables.hh b/src/nix/installables.hh
new file mode 100644
index 000000000..503984220
--- /dev/null
+++ b/src/nix/installables.hh
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "util.hh"
+#include "path.hh"
+#include "eval.hh"
+
+#include <optional>
+
+namespace nix {
+
+struct Buildable
+{
+ std::optional<StorePath> drvPath;
+ std::map<std::string, StorePath> outputs;
+};
+
+typedef std::vector<Buildable> Buildables;
+
+struct Installable
+{
+ virtual ~Installable() { }
+
+ virtual std::string what() = 0;
+
+ virtual Buildables toBuildables()
+ {
+ throw Error("argument '%s' cannot be built", what());
+ }
+
+ Buildable toBuildable();
+
+ virtual std::pair<Value *, Pos> 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<StorePath> getStorePath()
+ {
+ return {};
+ }
+};
+
+}