aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/command.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 15:48:14 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-10 15:48:14 +0000
commit8ba089597fa19bfd49ba5f22a5e821740ca4eb5d (patch)
treeb4f2299b9c973ef7636f8ce1bab0299dee4cc389 /src/libcmd/command.hh
parent13b6b645897fd2edaa0f09fa48d6fe8dd6287b55 (diff)
parent4d98143914120d0163f5c50f30ce8a5289433f8f (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'src/libcmd/command.hh')
-rw-r--r--src/libcmd/command.hh67
1 files changed, 13 insertions, 54 deletions
diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh
index 07f398468..0f6125f11 100644
--- a/src/libcmd/command.hh
+++ b/src/libcmd/command.hh
@@ -5,7 +5,6 @@
#include "common-eval-args.hh"
#include "path.hh"
#include "flake/lockfile.hh"
-#include "store-api.hh"
#include <optional>
@@ -43,6 +42,19 @@ private:
std::shared_ptr<Store> _store;
};
+/* A command that copies something between `--from` and `--to`
+ stores. */
+struct CopyCommand : virtual StoreCommand
+{
+ std::string srcUri, dstUri;
+
+ CopyCommand();
+
+ ref<Store> createStore() override;
+
+ ref<Store> getDstStore();
+};
+
struct EvalCommand : virtual StoreCommand, MixEvalArgs
{
EvalCommand();
@@ -69,14 +81,6 @@ struct MixFlakeOptions : virtual Args, EvalCommand
{ return {}; }
};
-/* How to handle derivations in commands that operate on store paths. */
-enum class OperateOn {
- /* Operate on the output path. */
- Output,
- /* Operate on the .drv path. */
- Derivation
-};
-
struct SourceExprCommand : virtual Args, MixFlakeOptions
{
std::optional<Path> file;
@@ -100,19 +104,6 @@ struct SourceExprCommand : virtual Args, MixFlakeOptions
void completeInstallable(std::string_view prefix);
};
-enum class Realise {
- /* Build the derivation. Postcondition: the
- derivation outputs exist. */
- Outputs,
- /* Don't build the derivation. Postcondition: the store derivation
- exists. */
- Derivation,
- /* Evaluate in dry-run mode. Postcondition: nothing. */
- // FIXME: currently unused, but could be revived if we can
- // evaluate derivations in-memory.
- Nothing
-};
-
/* A command that operates on a list of "installables", which can be
store paths, attribute paths, Nix expressions, etc. */
struct InstallablesCommand : virtual Args, SourceExprCommand
@@ -225,38 +216,6 @@ static RegisterCommand registerCommand2(std::vector<std::string> && name)
return RegisterCommand(std::move(name), [](){ return make_ref<T>(); });
}
-BuiltPaths build(
- ref<Store> evalStore,
- ref<Store> store, Realise mode,
- const std::vector<std::shared_ptr<Installable>> & installables,
- BuildMode bMode = bmNormal);
-
-std::set<StorePath> toStorePaths(
- ref<Store> evalStore,
- ref<Store> store,
- Realise mode,
- OperateOn operateOn,
- const std::vector<std::shared_ptr<Installable>> & installables);
-
-StorePath toStorePath(
- ref<Store> evalStore,
- ref<Store> store,
- Realise mode,
- OperateOn operateOn,
- std::shared_ptr<Installable> installable);
-
-std::set<StorePath> toDerivations(
- ref<Store> store,
- const std::vector<std::shared_ptr<Installable>> & installables,
- bool useDeriver = false);
-
-BuiltPaths toBuiltPaths(
- ref<Store> evalStore,
- ref<Store> store,
- Realise mode,
- OperateOn operateOn,
- const std::vector<std::shared_ptr<Installable>> & installables);
-
/* Helper function to generate args that invoke $EDITOR on
filename:lineno. */
Strings editorFor(const Pos & pos);