6.4 override vs overrideAttrs
Lesson 43 of 68 · 13:00
Up next in 5s…
About this lesson
Both override and overrideAttrs change a package, so which one do you use when? This lesson draws the line precisely: one re-calls your package function with different arguments, the other changes what goes into mkDerivation itself. We prove the difference on GNU hello with a compiler swap and a patch list.
In this video
- The one picture that shows what
overridecan touch and what onlyoverrideAttrscan reach - Building single attributes from a
release.nixwithnix build -A, and what your CI should build - Swapping
stdenvforclangStdenvwithoverrideand confirming it in the configure output - Changing the
patcheslist withoverrideAttrs, and whyoverridecannot do that here - Reading the old attributes before you change them, the part that confuses everyone at first
After this lesson
For any change you want to make to a package, you can name the right function in seconds and write the override without guessing. This is the exact question we get in every training, answered for good.