aboutsummaryrefslogtreecommitdiff
path: root/src/nix/command.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-03-31 14:46:15 +0200
committerGitHub <noreply@github.com>2020-03-31 14:46:15 +0200
commita7540294cfae82c098e8691cd5212a9184add574 (patch)
treee6ddf26579b0a887717d9cde7ddfccdf068bd703 /src/nix/command.hh
parentd4d456c6b16196d2acced587a9cb121bfce2a560 (diff)
parent3166b97174ab879dac3b19eb3f257e73a943fef0 (diff)
Merge pull request #3460 from NixOS/dev-shell
Backport 'nix dev-shell' from the flakes branch
Diffstat (limited to 'src/nix/command.hh')
-rw-r--r--src/nix/command.hh62
1 files changed, 34 insertions, 28 deletions
diff --git a/src/nix/command.hh b/src/nix/command.hh
index a954a7d04..23f5c9898 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -1,5 +1,6 @@
#pragma once
+#include "installables.hh"
#include "args.hh"
#include "common-eval-args.hh"
#include "path.hh"
@@ -22,34 +23,7 @@ private:
std::shared_ptr<Store> _store;
};
-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());
- }
-};
-
-struct SourceExprCommand : virtual Args, StoreCommand, MixEvalArgs
+struct SourceExprCommand : virtual StoreCommand, MixEvalArgs
{
Path file;
@@ -184,4 +158,36 @@ std::set<StorePath> toDerivations(ref<Store> store,
filename:lineno. */
Strings editorFor(const Pos & pos);
+struct MixProfile : virtual StoreCommand
+{
+ std::optional<Path> profile;
+
+ MixProfile();
+
+ /* If 'profile' is set, make it point at 'storePath'. */
+ void updateProfile(const StorePath & storePath);
+
+ /* If 'profile' is set, make it point at the store path produced
+ by 'buildables'. */
+ void updateProfile(const Buildables & buildables);
+};
+
+struct MixDefaultProfile : MixProfile
+{
+ MixDefaultProfile();
+};
+
+struct MixEnvironment : virtual Args {
+
+ StringSet keep, unset;
+ Strings stringsEnv;
+ std::vector<char*> vectorEnv;
+ bool ignoreEnvironment;
+
+ MixEnvironment();
+
+ /* Modify global environ based on ignoreEnvironment, keep, and unset. It's expected that exec will be called before this class goes out of scope, otherwise environ will become invalid. */
+ void setEnviron();
+};
+
}