[Nix-dev] Questions about the all-packages fixpoint
Benno Fünfstück
benno.fuenfstueck at gmail.com
Fri Mar 17 17:04:52 CET 2017
Hello all,
I am (again) wrapping my head around the current construction of the
package set. I think I understand how it works, but there's a few subtle
details that I feel like they are confusing, bur probably necessary. I
would like to understand why:
1. An override is given the arguments `self` and `super`, as expected. But
why does `super.callPackage` resolve dependencies from `self`? I would have
expected it to not know about `self`, and resolve dependencies in the scope
of `super`. If I wanted this behaviour, I would have used
`self.callPackage`, but the current behaviour makes that unnecessary. Why
is this implemented like that?
2. In `stage.nix`, why do we construct a *local* fixpoint just for
all-packages? The current code is:
allPackages = self: super:
let res = import ./all-packages.nix
{ inherit lib nixpkgsFun noSysDirs config; }
res self;
in res;
Even more confusingly, if we look at `all-packages.nix`, it is a function
defined like this:
{ lib, nixpkgsFun, noSysDirs, config}:
self: pkgs:
So the variable that is called `self` in `stage.nix` is bound to what is
called `pkgs` in `all-packages.nix`, and `self` in `all-packages.nix`
actually refers to what is called `res` in `stage.nix`!!!!
This is confusing to me. Also, why do we need `self` and `pkgs`? Wouldn't
one of them be enough?
Greetings,
Benno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170317/52548594/attachment.html>
More information about the nix-dev
mailing list