Nix 101 Course / Section 8: Overlays: changes that propagate downstream
Premium

8.2 Overlay basics: your first overlay.nix

Lesson 53 of 68 · 3:05

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

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 overlays parameter when importing nixpkgs
  • How the line between upstream packages, third party libraries, and your internal code disappears
  • The free bonus: pkgsStatic and pkgsCross variants 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.