nix.dev icon indicating copy to clipboard operation
nix.dev copied to clipboard

Interdependent package sets (with `callPackage`)

Open fricklerhandwerk opened this issue 2 years ago • 3 comments

Proposal

callPackage is used everywhere in Nixpkgs, but it's quite magical. It's very easy to use, so there are few instructions needed (rather a few good examples highlighting patterns where it makes particular sense to use it), but it requires understanding the rationale and inner workings.

Proposal

Import https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/ (source: https://github.com/NixOS/nixos-summer/blob/main/content/blog/callpackage-a-tool-for-the-lazy.md) to nix.dev, and expand it to provide the motivation for why it exists at the beginning, and possibly some more details on newScope and friends at the end.

Willing to help?

Can help with reviews.

Priorities

Add :+1: to issues you find important.

fricklerhandwerk avatar Jul 18 '23 08:07 fricklerhandwerk

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-07-31-documentation-team-meeting-notes-68/31127/1

nixos-discourse avatar Jul 31 '23 18:07 nixos-discourse

Related: https://github.com/NixOS/nixpkgs/pull/270696

lf- avatar Dec 14 '23 22:12 lf-

Given the linked callPackage article is probably easier to adapt into a tutorial, I renamed and relabeled the issue since I'll almost certainly address it myself this year.

fricklerhandwerk avatar Feb 07 '24 03:02 fricklerhandwerk

For future reference: https://nix.dev/tutorials/callpackage is the produced work.

philiptaron avatar Mar 19 '24 14:03 philiptaron