tazjin/nix-1p

Clarify the description of "callPackage"

Opened this issue · 1 comments

With reference to:

nix-1p/README.md

Lines 578 to 580 in 1cf10d3

The `callPackage` function looks at the expected arguments (via
`builtins.functionArgs`) and passes the appropriate keys from the set in which
it is defined as the values for each corresponding argument.

Looking specifically at the phrase "the set in which it is defined" it isn't clear:

  1. What is "it"? (the callpackage function?)

  2. Which set is being described?

The callpackage function does not appear to be defined as part of a set in this example:

nix-1p/README.md

Lines 572 to 575 in 1cf10d3

{ pkgs ? import <nixpkgs> {} }:
let my-funky-program = pkgs.callPackage ./my-funky-program.nix {};
in # ... something happens with my-funky-program

This is about the set from which you got the callPackage function, so in the case of pkgs.callPackage, "it" is that function itself, and the set is pkgs.

There are callPackage functions in multiple different sets (e.g. inside of pkgs.haskellPackages, pkgs.emacsPackages and so on) which all are capable of calling packages with the stuff defined in the set that they themselves are in.

Gonna think about a way to rephrase that ... ideas welcome!