8#include "flake/lockfile.hh"
14extern std::string programPath;
16extern char ** savedArgv;
23static constexpr Command::Category catHelp = -1;
24static constexpr Command::Category catSecondary = 100;
25static constexpr Command::Category catUtility = 101;
26static constexpr Command::Category catNixInstallation = 102;
28static constexpr auto installablesCategory =
29 "Options that change the interpretation of [installables](@docroot@/command-ref/new-cli/nix.md#installables)";
33 nlohmann::json toJSON()
override;
35 using MultiCommand::MultiCommand;
37 virtual void run()
override;
41#pragma GCC diagnostic ignored "-Woverloaded-virtual"
71 std::shared_ptr<Store> _store;
78struct CopyCommand :
virtual StoreCommand
80 std::string srcUri, dstUri;
92struct EvalCommand :
virtual StoreCommand, MixEvalArgs
94 bool startReplOnEvalErrors =
false;
95 bool ignoreExceptionsDuringTry =
false;
106 std::shared_ptr<Store> evalStore;
108 std::shared_ptr<EvalState> evalState;
115struct MixFlakeOptions :
virtual Args, EvalCommand
117 flake::LockFlags lockFlags;
135struct SourceExprCommand :
virtual Args, MixFlakeOptions
137 std::optional<Path> file;
138 std::optional<std::string> expr;
146 virtual Strings getDefaultFlakeAttrPaths();
148 virtual Strings getDefaultFlakeAttrPathPrefixes();
168struct MixReadOnlyOption :
virtual Args
179struct RawInstallablesCommand :
virtual Args, SourceExprCommand
181 RawInstallablesCommand();
188 virtual void applyDefaultInstallables(std::vector<std::string> & rawInstallables);
190 bool readFromStdIn =
false;
196 std::vector<std::string> rawInstallables;
213struct InstallableCommand :
virtual Args, SourceExprCommand
215 InstallableCommand();
225 std::string _installable{
"."};
228struct MixOperateOnOptions :
virtual Args
232 MixOperateOnOptions();
245 bool recursive =
false;
254 BuiltPathsCommand(
bool recursive =
false);
256 virtual void run(
ref<Store> store, BuiltPaths && allPaths, BuiltPaths && rootPaths) = 0;
260 void applyDefaultInstallables(std::vector<std::string> & rawInstallables)
override;
263struct StorePathsCommand :
public BuiltPathsCommand
265 StorePathsCommand(
bool recursive =
false);
285struct RegisterCommand
287 typedef std::map<std::vector<std::string>, std::function<ref<Command>()>> Commands;
288 static Commands * commands;
290 RegisterCommand(std::vector<std::string> &&
name, std::function<
ref<Command>()> command)
293 commands =
new Commands;
294 commands->emplace(
name, command);
297 static nix::Commands getCommandsFor(
const std::vector<std::string> & prefix);
312struct MixProfile :
virtual StoreCommand
314 std::optional<Path> profile;
319 void updateProfile(
const StorePath & storePath);
323 void updateProfile(
const BuiltPaths & buildables);
326struct MixDefaultProfile : MixProfile
331struct MixEnvironment :
virtual Args
336 std::map<std::string, std::string> setVars;
337 bool ignoreEnvironment;
350void completeFlakeInputPath(
353 const std::vector<FlakeRef> & flakeRefs,
354 std::string_view prefix);
358void completeFlakeRefWithFragment(
361 flake::LockFlags lockFlags,
362 Strings attrPathPrefixes,
363 const Strings & defaultFlakeAttrPaths,
364 std::string_view prefix);
366std::string showVersions(
const std::set<std::string> & versions);
368void printClosureDiff(
375void createOutLinks(
const std::filesystem::path & outLink,
const BuiltPaths & buildables,
LocalFSStore &
store);
std::function< CompleterFun > CompleterClosure
Definition args.hh:167
Definition local-fs-store.hh:46
Definition store-api.hh:169
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:103
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
const std::string_view & name
Definition lexer.l:1709
ref< Store > getDstStore() override
Definition command.cc:96
std::vector< FlakeRef > getFlakeRefsForCompletion() override
Definition installables.cc:882
Definition command.hh:204
virtual std::vector< FlakeRef > getFlakeRefsForCompletion()
Definition command.hh:129
virtual void run() override
Definition command.cc:40
Definition position.hh:20
std::vector< FlakeRef > getFlakeRefsForCompletion() override
Definition installables.cc:856
Definition command.hh:286
void completeInstallable(AddCompletions &completions, std::string_view prefix)
Definition installables.cc:260
CompleterClosure getCompleteInstallable()
Definition installables.cc:253
virtual void run(ref< Store >)=0
void run() override
Definition command.cc:69
virtual ref< Store > getDstStore()
Definition command.hh:59
ref< Store > getStore()
Definition command.cc:57
Definition command.hh:276