Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/libcmd/include/nix/cmd/command.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 1 addition & 9 deletions src/nix/copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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',
Expand Down
9 changes: 1 addition & 8 deletions src/nix/flake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/nix/sigs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct CmdSign : StorePathsCommand
.labels = {"file"},
.handler = {&secretKeyFile},
.completer = completePath,
.required = true,
});
}

Expand All @@ -114,9 +115,6 @@ struct CmdSign : StorePathsCommand

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));
LocalSigner signer(std::move(secretKey));

Expand Down
Loading