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

8.5 final vs prev: the two rule flavors

Lesson 56 of 68 · 12:22

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

Both final and prev are versions of nixpkgs, so which one do you write in your overlay? Even experienced Nix people give contradicting answers in the forums, and there is a reason: two competing rule sets exist. This lesson shows where the two references come from in the overlay application graph, then lays out both flavors so you and your team can pick one and stay consistent.

In this video

  • The overlay application graph: where prev and final point when several overlays stack on top of nixpkgs
  • The one combination that always ends in infinite recursion, traced on the graph
  • Flavor one, graph preserving: prev by default, final only when referencing one package from another
  • Flavor two, everything is overridable: final by default, prev only when overriding a package with itself
  • The grafting idea behind flavor one, the nixpkgs pull request that never got merged, and which flavor most teams actually choose today

After this lesson

You never guess between final and prev again. You apply one rule flavor consistently and can explain the trade-off behind the choice to your team.