16extern std::string programPath;
18extern char * * savedArgv;
24static constexpr Command::Category catHelp = -1;
25static constexpr Command::Category catSecondary = 100;
26static constexpr Command::Category catUtility = 101;
27static constexpr Command::Category catNixInstallation = 102;
29static constexpr auto installablesCategory =
"Options that change the interpretation of [installables](@docroot@/command-ref/new-cli/nix.md#installables)";
32#pragma GCC diagnostic ignored "-Woverloaded-virtual"
49 std::optional<ref<Store>> _store;
56struct CopyCommand :
virtual StoreCommand
58 std::string srcUri, dstUri;
70struct EvalCommand :
virtual StoreCommand, MixEvalArgs
72 bool startReplOnEvalErrors =
false;
73 bool ignoreExceptionsDuringTry =
false;
84 std::optional<ref<Store>> evalStore;
86 std::shared_ptr<eval_cache::CachingEvaluator> evalState;
93struct MixFlakeOptions :
virtual Args, EvalCommand
111struct SourceExprCommand :
virtual Args, MixFlakeOptions
113 std::optional<Path> file;
114 std::optional<std::string> expr;
126 virtual Strings getDefaultFlakeAttrPaths();
128 virtual Strings getDefaultFlakeAttrPathPrefixes();
148struct MixReadOnlyOption :
virtual Args
159struct RawInstallablesCommand :
virtual Args, SourceExprCommand
161 RawInstallablesCommand();
163 virtual void run(
ref<Store> store, std::vector<std::string> && rawInstallables) = 0;
168 virtual void applyDefaultInstallables(std::vector<std::string> & rawInstallables);
170 bool readFromStdIn =
false;
176 std::vector<std::string> rawInstallables;
187 void run(
ref<Store> store, std::vector<std::string> && rawInstallables)
override;
193struct InstallableCommand :
virtual Args, SourceExprCommand
195 InstallableCommand();
205 std::string _installable{
"."};
208struct MixOperateOnOptions :
virtual Args
212 MixOperateOnOptions();
225 bool recursive =
false;
234 BuiltPathsCommand(
bool recursive);
240 void applyDefaultInstallables(std::vector<std::string> & rawInstallables)
override;
243struct StorePathsCommand :
public BuiltPathsCommand
245 StorePathsCommand(
bool recursive =
false);
247 virtual void run(
ref<Store> store, StorePaths && storePaths) = 0;
259 void run(
ref<Store> store, StorePaths && storePaths)
override;
267 using CommandMap = std::map<
268 std::vector<std::string>,
271 static CommandMap * commands;
273 static void add(std::vector<std::string> && name,
277 commands =
new CommandMap;
279 commands->emplace(name, command);
282 static nix::CommandMap getCommandsFor(
const std::vector<std::string> & prefix);
285template<
typename Base>
286class MixAio :
public Base
292 template<
typename...
Args>
294 : Base(std::forward<Args>(args)...)
306static void registerCommand(
const std::string & name)
308 CommandRegistry::add({name}, [](AsyncIoRoot & aio) {
309 return make_ref<MixAio<T>>(aio);
314static void registerCommand2(std::vector<std::string> && name)
316 CommandRegistry::add(std::move(name), [](
AsyncIoRoot & aio) {
317 return make_ref<MixAio<T>>(aio);
321struct MixProfile :
virtual StoreCommand
323 std::optional<Path> profile;
328 void updateProfile(
const StorePath & storePath);
332 void updateProfile(
const BuiltPaths & buildables);
335struct MixDefaultProfile : MixProfile
340struct MixEnvironment :
virtual Args {
342 StringSet keep, unset;
344 std::vector<char*> vectorEnv;
345 bool ignoreEnvironment;
357void completeFlakeInputPath(
360 const std::vector<FlakeRef> & flakeRefs,
361 std::string_view prefix);
363void completeFlakeRef(
367void completeFlakeRefWithFragment(
372 Strings attrPathPrefixes,
373 const Strings & defaultFlakeAttrPaths,
374 std::string_view prefix);
376kj::Promise<Result<void>> printClosureDiff(
381 std::string_view indent);
std::function< CompleterFun > CompleterClosure
Definition args.hh:151
Definition store-api.hh:195
OperateOn
Definition installables.hh:44
@ Output
Definition installables.hh:48
Realise
Definition installables.hh:17
@ Derivation
Definition installables.hh:29
std::vector< ref< Installable > > Installables
Definition installables.hh:101
Definition command.hh:266
std::vector< FlakeRef > getFlakeRefsForCompletion() override
Definition installables.cc:847
Definition command.hh:184
virtual std::vector< FlakeRef > getFlakeRefsForCompletion()
Definition command.hh:107
Definition position.hh:19
std::vector< FlakeRef > getFlakeRefsForCompletion() override
Definition installables.cc:823
CompleterClosure getCompleteInstallable()
Definition installables.cc:203
void completeInstallable(EvalState &state, AddCompletions &completions, std::string_view prefix)
Definition installables.cc:210
virtual void run(ref< Store >)=0
void run() override
Definition command.cc:52
Definition command.hh:256