diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-03-31 14:46:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 14:46:15 +0200 |
commit | a7540294cfae82c098e8691cd5212a9184add574 (patch) | |
tree | e6ddf26579b0a887717d9cde7ddfccdf068bd703 /src/nix/installables.hh | |
parent | d4d456c6b16196d2acced587a9cb121bfce2a560 (diff) | |
parent | 3166b97174ab879dac3b19eb3f257e73a943fef0 (diff) |
Merge pull request #3460 from NixOS/dev-shell
Backport 'nix dev-shell' from the flakes branch
Diffstat (limited to 'src/nix/installables.hh')
-rw-r--r-- | src/nix/installables.hh | 45 |
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 {}; + } +}; + +} |