Hi,
after watching this talk, i have a question regarding extending pkgs.lib....
in an overlay:
Let’s say i have two overlays from different repos:
# overlay1.nix
final: prev: {
lib = prev.lib or {} // {
changeDerivation = drv: drv.overrideAttrs (...); # does "something"
};
}
# overlay2.nix
final: prev: {
foo = prev.callPackage ./foo.nix {};
foo-changed = prev.lib.changeDerivation final.foo;
}
I am using the variable names final
and prev
instead of self
and super
here.
As @nbp states in the talk (simplified):
- Never use
final
for anything else than accessing derivations - use
prev
for everything else
… overlay2 only accesses final
to access its own package foo
.
What feels bad is that i do now have to obey the order that overlay1 must be applied before overlay2, because otherwise prev.lib.changeDerivation
doesn’t exist yet.
If it was allowed to use final.lib.changeDerivation
, it would (and also actually does) work.
In the Q&A session there were two persons asking a similar question like me, but somehow i don’t really feel like i understand the reasoning behind why using final.lib.bla
is wrong.
It would certainly fix the requirement that the order of the overlays is now important…