8.6 Composing overlays
Lesson 57 of 68 · 2:41
Up next in 5s…
About this lesson
Why would anyone pass a list of 15 overlays to nixpkgs? Because overlays compose. This short lesson shows how separate overlays for production packages and debug instrumentation combine into a testing overlay, and how a whole list of overlays collapses into one that behaves like a single final: prev: function.
In this video
- One overlay for your product packages, a second that patches them with debug symbols and extra logging
- A testing overlay that is nothing but the two combined, so integration tests run against the instrumented build
- Swapping the plain overlay against the combined one to find out whether your debug changes break the tests
- Merging many overlays into one function, so consumers never see how many are behind it
- Where to read on:
lib/fixed-points.nixin the nixpkgs repository
After this lesson
You can package customizations as exchangeable building blocks, combine them per environment, and hand users a single overlay that hides the composition.
Builds on: Overlay basics (8.2)