14.2 not as obvious as expected
viraptor opened this issue · comments
Section 14.2 mentions:
The difference is obvious, as well as the advantages of this approach.
While the difference is described above:
We would like to avoid specifying the nix expression again, instead reuse the original graphviz attribute in the repository
I wasn't sure what the advantages are. (or is it a joke?) Some clarification about why would I care about the difference above would be great.
I agree that it isn't at all obvious from the example given - it's a little bit shorter, but that's it. There is however a distinct advantage to using overrides: it's not supposed to be a joke. The more important part of the message above the example is
But we may still be diverging from the original graphviz in the repository.
The difference would be better exemplified when the derivation you want to customize already has custom arguments. Say the original graphviz
derivation looked like this:
graphviz = callPackage ./graphviz.nix { bzip2 = customBzip2; };
Creating the customized derivation from scratch would then have to be done like this:
mygraphviz = callPackage ./graphviz.nix { gd = customgd; bzip2 = customBzip2; };
Forgetting to specify the custom bzip2
would yield a graphviz
derivation with only gd
being customized, which isn't what we want. override
, however, "remembers" that we want to use our custom bzip2
, so we only have to specify the custom gd
:
mygraphviz = graphviz.override { gd = customgd; };