mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Merge pull request #14271 from NixOS/no-check-sigs
Factor out `--no-check-sigs` into its own class
This commit is contained in:
commit
f84b33644c
4 changed files with 17 additions and 20 deletions
|
|
@ -350,6 +350,20 @@ struct MixEnvironment : virtual Args
|
||||||
void setEnviron();
|
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(
|
void completeFlakeInputAttrPath(
|
||||||
AddCompletions & completions,
|
AddCompletions & completions,
|
||||||
ref<EvalState> evalState,
|
ref<EvalState> evalState,
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,9 @@
|
||||||
|
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
|
||||||
struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand, MixProfile
|
struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand, MixProfile, MixNoCheckSigs
|
||||||
{
|
{
|
||||||
std::optional<std::filesystem::path> outLink;
|
std::optional<std::filesystem::path> outLink;
|
||||||
CheckSigsFlag checkSigs = CheckSigs;
|
|
||||||
|
|
||||||
SubstituteFlag substitute = NoSubstitute;
|
SubstituteFlag substitute = NoSubstitute;
|
||||||
|
|
||||||
|
|
@ -24,13 +23,6 @@ struct CmdCopy : virtual CopyCommand, virtual BuiltPathsCommand, MixProfile
|
||||||
.handler = {&outLink},
|
.handler = {&outLink},
|
||||||
.completer = completePath,
|
.completer = completePath,
|
||||||
});
|
});
|
||||||
|
|
||||||
addFlag({
|
|
||||||
.longName = "no-check-sigs",
|
|
||||||
.description = "Do not require that paths are signed by trusted keys.",
|
|
||||||
.handler = {&checkSigs, NoCheckSigs},
|
|
||||||
});
|
|
||||||
|
|
||||||
addFlag({
|
addFlag({
|
||||||
.longName = "substitute-on-destination",
|
.longName = "substitute-on-destination",
|
||||||
.shortName = 's',
|
.shortName = 's',
|
||||||
|
|
|
||||||
|
|
@ -1032,12 +1032,10 @@ struct CmdFlakeClone : FlakeCommand
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun
|
struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun, MixNoCheckSigs
|
||||||
{
|
{
|
||||||
std::string dstUri;
|
std::string dstUri;
|
||||||
|
|
||||||
CheckSigsFlag checkSigs = CheckSigs;
|
|
||||||
|
|
||||||
SubstituteFlag substitute = NoSubstitute;
|
SubstituteFlag substitute = NoSubstitute;
|
||||||
|
|
||||||
CmdFlakeArchive()
|
CmdFlakeArchive()
|
||||||
|
|
@ -1048,11 +1046,6 @@ struct CmdFlakeArchive : FlakeCommand, MixJSON, MixDryRun
|
||||||
.labels = {"store-uri"},
|
.labels = {"store-uri"},
|
||||||
.handler = {&dstUri},
|
.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
|
std::string description() override
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ struct CmdSign : StorePathsCommand
|
||||||
.labels = {"file"},
|
.labels = {"file"},
|
||||||
.handler = {&secretKeyFile},
|
.handler = {&secretKeyFile},
|
||||||
.completer = completePath,
|
.completer = completePath,
|
||||||
|
.required = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,9 +115,6 @@ struct CmdSign : StorePathsCommand
|
||||||
|
|
||||||
void run(ref<Store> store, StorePaths && storePaths) override
|
void run(ref<Store> store, StorePaths && storePaths) override
|
||||||
{
|
{
|
||||||
if (secretKeyFile.empty())
|
|
||||||
throw UsageError("you must specify a secret key file using '-k'");
|
|
||||||
|
|
||||||
SecretKey secretKey(readFile(secretKeyFile));
|
SecretKey secretKey(readFile(secretKeyFile));
|
||||||
LocalSigner signer(std::move(secretKey));
|
LocalSigner signer(std::move(secretKey));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue