Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
callPackage is a complex function (reasons include the Nix language being lazy, usage of fixed-point evaluation, overrides, etc.), and this complexity steals the spotlight from what this function a...
#3: Post edited
There are a plethora of online resources about this topic (see below), but I need this one explained to me like I'm 5 every time a I take at least a month off working with Nix.The aforementioned resources:- + \[`nix.dev`] [Package parameters and overrides with callPackage — nix.dev documentation](https://nix.dev/tutorials/callpackage)
- + \[`Nix Pills`] [13. Callpackage Design Pattern](https://nixos.org/guides/nix-pills/13-callpackage-design-pattern)
- + \[`Nix-Book`] [Imports and callPackage - Nix-Book](https://book.divnix.com/ch05-03-imports-and-callpackage.html)
- + [Nixpkgs commit][1] and [email][2] introducing `callPackage`
- + \[`stackoverflow`] [Where is `callPackage` defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)?](https://stackoverflow.com/questions/56121361/where-is-callpackage-defined-in-the-nixpkgs-repo-or-how-to-find-nix-lambda-de)
- + \[`NixOS Discourse`] [Where is `callPackage` defined exactly? (part 2) - Help - NixOS Discourse](https://discourse.nixos.org/t/where-is-callpackage-defined-exactly-part-2/12524)
- + \[`Nixpkgs repo`] [Issue #36354 - Document what callPackage does and its preconditions](https://github.com/NixOS/nixpkgs/issues/36354)
- + \[`Summer of Nix`] [`callPackage`, a tool for the lazy](https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/)
- + \[`NixOS & Flakes Book`] [`pkgs.callPackage`](https://nixos-and-flakes.thiscute.world/nixpkgs/callpackage)
- [1]: https://github.com/nixos/nixpkgs/commit/d17f0f9cbca38fabb71624f069cd4c0d6feace92
- [2]: https://www.mail-archive.com/nix-dev@cs.uu.nl/msg02624.html
- `callPackage` is a complex function (reasons include the Nix language being lazy, usage of fixed-point evaluation, overrides, etc.), and this complexity steals the spotlight from what this function actually does and why is it so useful.
- There are a plethora of online resources about this topic (see below), but I couldn't find a simple, concise summary.
- + \[`nix.dev`] [Package parameters and overrides with callPackage — nix.dev documentation](https://nix.dev/tutorials/callpackage)
- + \[`Nix Pills`] [13. Callpackage Design Pattern](https://nixos.org/guides/nix-pills/13-callpackage-design-pattern)
- + \[`Nix-Book`] [Imports and callPackage - Nix-Book](https://book.divnix.com/ch05-03-imports-and-callpackage.html)
- + [Nixpkgs commit][1] and [email][2] introducing `callPackage`
- + \[`stackoverflow`] [Where is `callPackage` defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)?](https://stackoverflow.com/questions/56121361/where-is-callpackage-defined-in-the-nixpkgs-repo-or-how-to-find-nix-lambda-de)
- + \[`NixOS Discourse`] [Where is `callPackage` defined exactly? (part 2) - Help - NixOS Discourse](https://discourse.nixos.org/t/where-is-callpackage-defined-exactly-part-2/12524)
- + \[`Nixpkgs repo`] [Issue #36354 - Document what callPackage does and its preconditions](https://github.com/NixOS/nixpkgs/issues/36354)
- + \[`Summer of Nix`] [`callPackage`, a tool for the lazy](https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/)
- + \[`NixOS & Flakes Book`] [`pkgs.callPackage`](https://nixos-and-flakes.thiscute.world/nixpkgs/callpackage)
- [1]: https://github.com/nixos/nixpkgs/commit/d17f0f9cbca38fabb71624f069cd4c0d6feace92
- [2]: https://www.mail-archive.com/nix-dev@cs.uu.nl/msg02624.html
#2: Post edited
- There are a plethora of online resources about this topic (see below), but I need this one explained to me like I'm 5 every time a I take at least a month off working with Nix.
- The aforementioned resources:
- + \[`nix.dev`] [Package parameters and overrides with callPackage — nix.dev documentation](https://nix.dev/tutorials/callpackage)
- + \[`Nix Pills`] [13. Callpackage Design Pattern](https://nixos.org/guides/nix-pills/13-callpackage-design-pattern)
- + \[`Nix-Book`] [Imports and callPackage - Nix-Book](https://book.divnix.com/ch05-03-imports-and-callpackage.html)
- + [Nixpkgs commit][1] and [email][2] introducing `callPackage`
- + \[`stackoverflow`] [Where is `callPackage` defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)?](https://stackoverflow.com/questions/56121361/where-is-callpackage-defined-in-the-nixpkgs-repo-or-how-to-find-nix-lambda-de)
- + \[`NixOS Discourse`] [Where is `callPackage` defined exactly? (part 2) - Help - NixOS Discourse](https://discourse.nixos.org/t/where-is-callpackage-defined-exactly-part-2/12524)
- + \[`Nixpkgs repo`] [Issue #36354 - Document what callPackage does and its preconditions](https://github.com/NixOS/nixpkgs/issues/36354)
- + \[`Summer of Nix`] [`callPackage`, a tool for the lazy](https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/)
- [1]: https://github.com/nixos/nixpkgs/commit/d17f0f9cbca38fabb71624f069cd4c0d6feace92
- [2]: https://www.mail-archive.com/nix-dev@cs.uu.nl/msg02624.html
- There are a plethora of online resources about this topic (see below), but I need this one explained to me like I'm 5 every time a I take at least a month off working with Nix.
- The aforementioned resources:
- + \[`nix.dev`] [Package parameters and overrides with callPackage — nix.dev documentation](https://nix.dev/tutorials/callpackage)
- + \[`Nix Pills`] [13. Callpackage Design Pattern](https://nixos.org/guides/nix-pills/13-callpackage-design-pattern)
- + \[`Nix-Book`] [Imports and callPackage - Nix-Book](https://book.divnix.com/ch05-03-imports-and-callpackage.html)
- + [Nixpkgs commit][1] and [email][2] introducing `callPackage`
- + \[`stackoverflow`] [Where is `callPackage` defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)?](https://stackoverflow.com/questions/56121361/where-is-callpackage-defined-in-the-nixpkgs-repo-or-how-to-find-nix-lambda-de)
- + \[`NixOS Discourse`] [Where is `callPackage` defined exactly? (part 2) - Help - NixOS Discourse](https://discourse.nixos.org/t/where-is-callpackage-defined-exactly-part-2/12524)
- + \[`Nixpkgs repo`] [Issue #36354 - Document what callPackage does and its preconditions](https://github.com/NixOS/nixpkgs/issues/36354)
- + \[`Summer of Nix`] [`callPackage`, a tool for the lazy](https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/)
- + \[`NixOS & Flakes Book`] [`pkgs.callPackage`](https://nixos-and-flakes.thiscute.world/nixpkgs/callpackage)
- [1]: https://github.com/nixos/nixpkgs/commit/d17f0f9cbca38fabb71624f069cd4c0d6feace92
- [2]: https://www.mail-archive.com/nix-dev@cs.uu.nl/msg02624.html
#1: Initial revision
What does Nixpkgs' `callPackage` do?
There are a plethora of online resources about this topic (see below), but I need this one explained to me like I'm 5 every time a I take at least a month off working with Nix. The aforementioned resources: + \[`nix.dev`] [Package parameters and overrides with callPackage — nix.dev documentation](https://nix.dev/tutorials/callpackage) + \[`Nix Pills`] [13. Callpackage Design Pattern](https://nixos.org/guides/nix-pills/13-callpackage-design-pattern) + \[`Nix-Book`] [Imports and callPackage - Nix-Book](https://book.divnix.com/ch05-03-imports-and-callpackage.html) + [Nixpkgs commit][1] and [email][2] introducing `callPackage` + \[`stackoverflow`] [Where is `callPackage` defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)?](https://stackoverflow.com/questions/56121361/where-is-callpackage-defined-in-the-nixpkgs-repo-or-how-to-find-nix-lambda-de) + \[`NixOS Discourse`] [Where is `callPackage` defined exactly? (part 2) - Help - NixOS Discourse](https://discourse.nixos.org/t/where-is-callpackage-defined-exactly-part-2/12524) + \[`Nixpkgs repo`] [Issue #36354 - Document what callPackage does and its preconditions](https://github.com/NixOS/nixpkgs/issues/36354) + \[`Summer of Nix`] [`callPackage`, a tool for the lazy](https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/) [1]: https://github.com/nixos/nixpkgs/commit/d17f0f9cbca38fabb71624f069cd4c0d6feace92 [2]: https://www.mail-archive.com/nix-dev@cs.uu.nl/msg02624.html