Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14.2 not as obvious as expected #179

Open
viraptor opened this issue Oct 28, 2021 · 1 comment
Open

14.2 not as obvious as expected #179

viraptor opened this issue Oct 28, 2021 · 1 comment

Comments

@viraptor
Copy link

viraptor commented Oct 28, 2021

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.

@talyz
Copy link

talyz commented Oct 31, 2021

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; };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants