Open nh2 opened 6 years ago
Yeah, probably what you want is called callPackages
.
+1, I always confuse between callPackages
and callPackage
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Just documenting this as I got confused as well:
$ nix repl <nixpkgs>
nix-repl> callPackages
«lambda @ /nix/store/w..q-nixos-20.09.2624.1eff582e7ea/nixos/lib/customisation.nix:127:32»
nix-repl> callPackage
«lambda @ /nix/store/w..q-nixos-20.09.2624.1eff582e7ea/nixos/lib/customisation.nix:117:31»
I marked this as stale due to inactivity. → More info
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2022-10-22-documentation-team-meeting-notes-12-nixcon-edition/22689/1
The docs about
callPackage
(which are surprisingly here in the nix manual, and not in the nixpkgs manual where I would expect them)
Looks like it's not in the Nix manual anymore either, so as far as I can tell callPackage
is just generally undocumented outside of source or things like Nix Pills.
Having an unhealthy obsession trying to understand Nix basics from time to time, here are some notes regarding callPackage
:
summer of nix
callPackage, a tool for the lazy
Just found this looking up my notes - didn't even know that such a write-up existed. Have only been able to rush through it, but it looks like the most comprehensive treatise on the topic. Perhaps the corresponding pull request #41 in the Summer of Nix repo is worth a glance too.
stackoverflow
Where is callPackage
defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)? w
nixos discourse
Where is callPackage
defined exactly? (part 2)
Tangential:
Also related: https://github.com/NixOS/nix.dev/issues/651
I just lost some time on a misunderstanding about
callPackage
.I changed from
x = callPackage ./myfile.nix {}
withmyfile.nix
just amkDerivation
as top-level expression, tox = (callPackage ./mfile.nix {}).val
and changingmyfile.nix
to contain{ val = mkDerivation ... }
.When I did that all my stuff broke.
So it looks like
callPackage
expects not only its inputs of a certain form, but also its outputs. I couldn't find this explained anywhere.The docs about
callPackage
(which are surprisingly here in the nix manual, and not in the nixpkgs manual where I would expect them), saywhich sugggests
callPackage
is just a convenient wrapper that fills in arguments to the given expression file, and that otherwise it would return the same values as if I called that expression manually.So I think we should document that
callPackage
does more than only input filling and has expectations about the expression returned by the file.