Scope down --derivation
to just the commands that use it
Per the old FIXME, this flag was on too many commands, and mostly ignored. Now it is just on the commands where it actually has an effect. Per https://github.com/NixOS/nix/issues/7261, I would still like to get rid of it entirely, but that is a separate project. This change should be good with or without doing that.
This commit is contained in:
parent
6352e20bc8
commit
44bea52ae3
|
@ -127,6 +127,16 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
return ref<EvalState>(evalState);
|
return ref<EvalState>(evalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MixOperateOnOptions::MixOperateOnOptions()
|
||||||
|
{
|
||||||
|
addFlag({
|
||||||
|
.longName = "derivation",
|
||||||
|
.description = "Operate on the [store derivation](../../glossary.md#gloss-store-derivation) rather than its outputs.",
|
||||||
|
.category = installablesCategory,
|
||||||
|
.handler = {&operateOn, OperateOn::Derivation},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
BuiltPathsCommand::BuiltPathsCommand(bool recursive)
|
BuiltPathsCommand::BuiltPathsCommand(bool recursive)
|
||||||
: recursive(recursive)
|
: recursive(recursive)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,9 +96,6 @@ struct SourceExprCommand : virtual Args, MixFlakeOptions
|
||||||
std::optional<std::string> expr;
|
std::optional<std::string> expr;
|
||||||
bool readOnlyMode = false;
|
bool readOnlyMode = false;
|
||||||
|
|
||||||
// FIXME: move this; not all commands (e.g. 'nix run') use it.
|
|
||||||
OperateOn operateOn = OperateOn::Output;
|
|
||||||
|
|
||||||
SourceExprCommand(bool supportReadOnlyMode = false);
|
SourceExprCommand(bool supportReadOnlyMode = false);
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Installable>> parseInstallables(
|
std::vector<std::shared_ptr<Installable>> parseInstallables(
|
||||||
|
@ -153,8 +150,15 @@ private:
|
||||||
std::string _installable{"."};
|
std::string _installable{"."};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MixOperateOnOptions : virtual Args
|
||||||
|
{
|
||||||
|
OperateOn operateOn = OperateOn::Output;
|
||||||
|
|
||||||
|
MixOperateOnOptions();
|
||||||
|
};
|
||||||
|
|
||||||
/* A command that operates on zero or more store paths. */
|
/* A command that operates on zero or more store paths. */
|
||||||
struct BuiltPathsCommand : public InstallablesCommand
|
struct BuiltPathsCommand : InstallablesCommand, virtual MixOperateOnOptions
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -167,13 +167,6 @@ SourceExprCommand::SourceExprCommand(bool supportReadOnlyMode)
|
||||||
.handler = {&expr}
|
.handler = {&expr}
|
||||||
});
|
});
|
||||||
|
|
||||||
addFlag({
|
|
||||||
.longName = "derivation",
|
|
||||||
.description = "Operate on the [store derivation](../../glossary.md#gloss-store-derivation) rather than its outputs.",
|
|
||||||
.category = installablesCategory,
|
|
||||||
.handler = {&operateOn, OperateOn::Derivation},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (supportReadOnlyMode) {
|
if (supportReadOnlyMode) {
|
||||||
addFlag({
|
addFlag({
|
||||||
.longName = "read-only",
|
.longName = "read-only",
|
||||||
|
|
|
@ -106,7 +106,7 @@ void printClosureDiff(
|
||||||
|
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
|
||||||
struct CmdDiffClosures : SourceExprCommand
|
struct CmdDiffClosures : SourceExprCommand, MixOperateOnOptions
|
||||||
{
|
{
|
||||||
std::string _before, _after;
|
std::string _before, _after;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ static std::string filterPrintable(const std::string & s)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CmdWhyDepends : SourceExprCommand
|
struct CmdWhyDepends : SourceExprCommand, MixOperateOnOptions
|
||||||
{
|
{
|
||||||
std::string _package, _dependency;
|
std::string _package, _dependency;
|
||||||
bool all = false;
|
bool all = false;
|
||||||
|
|
Loading…
Reference in a new issue