8.2 Overlay basics: your first overlay.nix
Lesson 53 of 68 · 3:05
Up next in 5s…
About this lesson
Your first working overlay: a small overlay.nix file that adds a package to nixpkgs so it looks and feels like it was always there. You learn the final: prev: function shape, how to pass overlays when importing nixpkgs, and a strong reason to define your packages in overlays instead of directly in your flake.nix.
In this video
- The smallest possible overlay: one file, one function, one new attribute on top of roughly 100,000 existing packages
- Why it is called an overlay: what the returned attribute set actually lays over
- Installing it through the
overlaysparameter when importing nixpkgs - How the line between upstream packages, third party libraries, and your internal code disappears
- The free bonus:
pkgsStaticandpkgsCrossvariants of your package appear automatically
After this lesson
You can add your own packages to nixpkgs through an overlay and consume them like first class packages, with flakes or without.