mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
Merge pull request #7754 from obsidiansystems/narrower-scope-derivation-flag
Scope down `--derivation` to just the commands that use it
This commit is contained in:
commit
5597d68e2d
6 changed files with 21 additions and 14 deletions
|
@ -127,6 +127,16 @@ ref<EvalState> EvalCommand::getEvalState()
|
|||
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)
|
||||
: recursive(recursive)
|
||||
{
|
||||
|
|
|
@ -96,9 +96,6 @@ struct SourceExprCommand : virtual Args, MixFlakeOptions
|
|||
std::optional<std::string> expr;
|
||||
bool readOnlyMode = false;
|
||||
|
||||
// FIXME: move this; not all commands (e.g. 'nix run') use it.
|
||||
OperateOn operateOn = OperateOn::Output;
|
||||
|
||||
SourceExprCommand(bool supportReadOnlyMode = false);
|
||||
|
||||
std::vector<std::shared_ptr<Installable>> parseInstallables(
|
||||
|
@ -153,8 +150,15 @@ private:
|
|||
std::string _installable{"."};
|
||||
};
|
||||
|
||||
struct MixOperateOnOptions : virtual Args
|
||||
{
|
||||
OperateOn operateOn = OperateOn::Output;
|
||||
|
||||
MixOperateOnOptions();
|
||||
};
|
||||
|
||||
/* A command that operates on zero or more store paths. */
|
||||
struct BuiltPathsCommand : public InstallablesCommand
|
||||
struct BuiltPathsCommand : InstallablesCommand, virtual MixOperateOnOptions
|
||||
{
|
||||
private:
|
||||
|
||||
|
|
|
@ -167,13 +167,6 @@ SourceExprCommand::SourceExprCommand(bool supportReadOnlyMode)
|
|||
.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) {
|
||||
addFlag({
|
||||
.longName = "read-only",
|
||||
|
|
|
@ -106,7 +106,7 @@ void printClosureDiff(
|
|||
|
||||
using namespace nix;
|
||||
|
||||
struct CmdDiffClosures : SourceExprCommand
|
||||
struct CmdDiffClosures : SourceExprCommand, MixOperateOnOptions
|
||||
{
|
||||
std::string _before, _after;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static std::string filterPrintable(const std::string & s)
|
|||
return res;
|
||||
}
|
||||
|
||||
struct CmdWhyDepends : SourceExprCommand
|
||||
struct CmdWhyDepends : SourceExprCommand, MixOperateOnOptions
|
||||
{
|
||||
std::string _package, _dependency;
|
||||
bool all = false;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
source common.sh
|
||||
|
||||
drv=$(nix-instantiate --experimental-features ca-derivations ./content-addressed.nix -A rootCA --arg seed 1)
|
||||
nix --experimental-features 'nix-command ca-derivations' show-derivation --derivation "$drv" --arg seed 1
|
||||
nix --experimental-features 'nix-command ca-derivations' show-derivation "$drv" --arg seed 1
|
||||
|
||||
buildAttr () {
|
||||
local derivationPath=$1
|
||||
|
|
Loading…
Reference in a new issue