Add: Overlays concept / tutorial - introduction to overlays
Learning goals
-
Understand overlays concept
-
What is the problem
-
How do overlays solve it
-
How to use them -> override pkgs within the fixed point
Prerequisites
- Understand a package set
- Understand a fixed point
Outline
Prior art
- https://discourse.nixos.org/t/what-are-overlays/14680
- https://wiki.nixos.org/wiki/Overlays
- https://nixcademy.com/posts/mastering-nixpkgs-overlays-techniques-and-best-practice/
Willing to help?
Yes
Priorities
Add :+1: to issues you find important.
Did the overlays section ever get added to nix.dev?
Could we include an updated version of this explanation: https://blog.layus.be/posts/2020-06-12-nix-overlays.html
Yes, I'd be happy to review any contributions.
If you want to do it:
Structure for explaining overlays could be:
- Introduce terminology (prerequisites, keep it simple, write last)
- Start with a simple example
- Explain what it does
- Give a more complex example
- Explain what it does
Avoid:
Upfront explanations, without examples: (order: example -> explanation)
- Bad:
Overlays provide a method to extend and change nixpkgs. They replace constructs like packageOverride and overridePackages ...(copied from discourse) - Better (show examples, maybe not the best one from the wiki):
Consider this simple example
final: prev: {
google-chrome = prev.google-chrome.override {
commandLineArgs =
"--proxy-server='https=127.0.0.1:3128;http=127.0.0.1:3128'";
};
};
It sets the default proxy in Google Chrome
It seems counter-intuitive, but show the code first. Understanding builds gradually from that examples later.
Thanks @hsjobeki , will try to get to it this weekend! I also noticed that devshells were not included in the wiki, so maybe I can have a look at that as well. I really like this style of example-accompanied descriptions, and I look forward to contributing!