Skip to content
Closed
Changes from 1 commit
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
22 changes: 20 additions & 2 deletions src/libexpr/primops/fetchTree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,26 @@ static void prim_fetchTree(EvalState & state, const PosIdx pos, Value * * args,
fetchTree(state, pos, args, v, std::nullopt, FetchTreeParams { .allowNameArgument = false });
}

// FIXME: document
static RegisterPrimOp primop_fetchTree("fetchTree", 1, prim_fetchTree);
static RegisterPrimOp primop_fetchTree({
.name = "fetchTree",
.args = {"args"},
.arity = 1,
.doc = R"(
Introduced in 2.4

The fetcher infrastructure is exposed via the `fetchTree` built-in.

Comment thread
elikoga marked this conversation as resolved.
Outdated
`builtins.fetchTree` allows fetching a source tree using any
backends supported by the fetcher infrastructure. It subsumes the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't mention "fetcher infrastructure". Instead it can refer to the docs on flake references (https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references), specifically the attrset form.

functionality of existing built-ins like `fetchGit`,
`fetchMercurial` and `fetchTarball`.

`builtins.fetchTree` can be used to fetch
plain files over the `http(s)` and `file` protocols in addition to
directory tarballs.
)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be one or two examples here of how to use fetchTree.

It should also mention that fetchTree is experimental and that it requires a locked flakeref in pure eval mode (which is the default).

.fun = prim_fetchTree,
});

static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v,
const std::string & who, bool unpack, std::string name)
Expand Down