Skip to content

Commit

Permalink
fetchTree: add publicKeys as list input attribute
Browse files Browse the repository at this point in the history
This adds the option of giving publicKeys as a list of attrsets
analogous to the flake fetcher input attribute.
  • Loading branch information
flandweber committed Aug 24, 2023
1 parent 1104fc9 commit 4120542
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libexpr/primops/fetchTree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "filetransfer.hh"
#include "registry.hh"
#include "url.hh"
#include "flake/flake.hh"

#include <ctime>
#include <iomanip>
Expand Down Expand Up @@ -153,8 +154,13 @@ static void fetchTree(
else if (attr.value->type() == nInt)
attrs.emplace(state.symbols[attr.name], uint64_t(attr.value->integer));
else
state.debugThrowLastTrace(TypeError("fetchTree argument '%s' is %s while a string, Boolean or integer is expected",
state.symbols[attr.name], showType(*attr.value)));
if (state.symbols[attr.name] == "publicKeys") {
std::vector<nix::fetchers::PublicKey> publicKeys;
parsePublicKeysList(state, attr, publicKeys);
attrs.emplace(state.symbols[attr.name], publicKeys_to_string(publicKeys));
} else
state.debugThrowLastTrace(TypeError("fetchTree argument '%s' is %s while a string, Boolean or integer is expected",
state.symbols[attr.name], showType(*attr.value)));
}

if (!params.allowNameArgument)
Expand Down

0 comments on commit 4120542

Please sign in to comment.