1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

Factor out --no-check-sigs

This commit is contained in:
Eelco Dolstra 2025-10-16 12:42:53 +02:00
parent 0503a862ef
commit 139df77440
3 changed files with 16 additions and 17 deletions

View file

@ -350,6 +350,20 @@ struct MixEnvironment : virtual Args
void setEnviron();
};
struct MixNoCheckSigs : virtual Args
{
CheckSigsFlag checkSigs = CheckSigs;
MixNoCheckSigs()
{
addFlag({
.longName = "no-check-sigs",
.description = "Do not require that paths are signed by trusted keys.",
.handler = {&checkSigs, NoCheckSigs},
});
}
};
void completeFlakeInputAttrPath(
AddCompletions & completions,
ref<EvalState> evalState,

View file

@ -5,10 +5,9 @@
using namespace nix;
struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand, MixProfile
struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand, MixProfile, MixNoCheckSigs
{
std::optional<std::filesystem::path> outLink;
CheckSigsFlag checkSigs = CheckSigs;
SubstituteFlag substitute = NoSubstitute;
@ -24,13 +23,6 @@ struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand, MixProfile
.handler = {&outLink},
.completer = completePath,
});
addFlag({
.longName = "no-check-sigs",
.description = "Do not require that paths are signed by trusted keys.",
.handler = {&checkSigs, NoCheckSigs},
});
addFlag({
.longName = "substitute-on-destination",
.shortName = 's',

View file

@ -1032,12 +1032,10 @@ struct CmdFlakeClone : FlakeCommand
}
};
struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun
struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun, MixNoCheckSigs
{
std::string dstUri;
CheckSigsFlag checkSigs = CheckSigs;
SubstituteFlag substitute = NoSubstitute;
CmdFlakeArchive()
@ -1048,11 +1046,6 @@ struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun
.labels = {"store-uri"},
.handler = {&dstUri},
});
addFlag({
.longName = "no-check-sigs",
.description = "Do not require that paths are signed by trusted keys.",
.handler = {&checkSigs, NoCheckSigs},
});
}
std::string description() override