NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.81k stars 1.52k forks source link

Document <nix/fetchurl.nix> #3493

Open PkmX opened 4 years ago

PkmX commented 4 years ago

The builder of a derivation accepts a few builtin builders as described here:

https://github.com/NixOS/nix/blob/512753f8247b927b62fd9391ee5ba6dda29ea4d4/src/libstore/build.cc#L3497

These should be documented somewhere and how they differ from some builtin functions. From my understanding builtins.fetchurl fetches during instantiation time but a derivation using builtins:fetchurl as builder downloads when actually realizing the derivation.

edolstra commented 4 years ago

No, they shouldn't be documented because they're internal. But <nix/fetchurl.nix> should be documented though.

PkmX commented 4 years ago

Sounds good for me, since that is supposed to be the user-facing API.

domenkozar commented 4 years ago

Duplicate of #1489 then

PkmX commented 4 years ago

It's not really a duplicate of #1489, which is about the builtins.fetchurl function. This is about the function from <nix/fetchurl.nix> which is a derivation that calls a builtin builder.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

edolstra commented 3 years ago

Still relevant.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

jsoo1 commented 1 year ago

Can we make the builtin builders user-facing? We actually used <nix/fetchurl.nix> and corepkgs in production because they really help solving bootstrapping problems. corepkgs (and builtins:fetchurl and builtins:unpack-channel) were very helpful bootstrapping a nixpkgs from.

Especially in airgapped situations this can be extremely helpful since the fetchers do not (yet) try substitutes.

edolstra commented 1 year ago

:+1: on documenting <nix/fetchurl.nix> / builtins:fetchurl, but builtins:unpack-channel is too nix-channel-specific to document. Ideally we would remove it in the future (nix profile doesn't use it anymore IIRC).

jsoo1 commented 1 year ago

sweet! My only nit with that is that builtin:unpack-channel is close enough to a general unpacker that it is very close to a general-purpose builtin:unpack that is also very useful during bootstrap.