Nix 101 Course / Section 9: Flakes
Premium

9.10 When to flake, and when not to

Lesson 68 of 68 · 14:02

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

Video chapters

  1. 0:00 Flakes trade-offs overview
  2. 1:14 Monorepo performance and cache misses
  3. 3:43 Git awareness and ignored files
  4. 5:39 Parameterization limits in Flakes
  5. 7:22 Overlays vs follows
  6. 9:17 Developer experience vs consumer workflows
  7. 11:30 When to use Flakes and final recommendations
Transcript

Flakes trade-offs overview

0:00 Okay, so in this final Flake section video I would like to discuss with you the trade-offs in Flakes, because I hope that you have seen, even before the Flake section, that Nix can do all the things that they need from it, and they want it actually without Flakes. That the new Flake commands are not always developer-centric, but more user-centric, and as a developer you need more parameters to get the same thing in many situations. Also, Flakes are not really your friend if you, for example, work in monorepositories or similar things, and I just want to inform you about the good things and the bad things on Flakes, so that you kind of do an informed decision where to use them and where not.

0:43 Multiple of our customers, after and/or without attending all the trainings, have started to drop Flakes and not using them, especially the other Flake implementations, I mean the other Nix implementations, Lix, Tvix, Nix and so on. There's some criticism towards Flakes, and the question is if Flakes will really become stabilized in the sense that they are always on by default, or if they will get dropped. At some point there's a 50/50 chance for both.

Monorepo performance and cache misses

1:14 I mean, I'm using them in some scenarios, but not in all of them. In general, what are the disadvantages and the trade-offs of Flakes? We already discussed what is good about them, the improved evaluation, evaluation closures, the built-in locking, nested locking and so on and so on. It's not silver bullets, it can be used in ways that are weird, and sometimes people actually do that, and people have also built weird mechanisms that solve problems with Flakes that you don't have without.

The full transcript comes with the lesson.

About this lesson

The final lesson of the flakes section answers the question everything has been building toward: when are flakes the right tool, and when do they get in your way? Drawn from real customer projects, you get the honest trade-offs: evaluation caching that developers rarely benefit from, git awareness that helps and hurts, and a design that cannot be parameterized.

In this video

  • Why a one-character change to your README can trigger copying a gigabyte repository into the Nix store
  • The git index surprise that makes flakes ignore your new files, and who that behavior actually serves
  • Why follows is not a substitute for overlays, no matter how often people claim it is
  • Flakes as a user feature versus a developer feature, and what that means for monorepos
  • The dual-use design: one project layout, built on overlays, that serves flake users, non-flake users and every pinning tool

After this lesson

You can make an informed call for each project: where to provide a flake, where to skip one, and how an overlay-centric layout keeps both doors open without a company-wide policy fight.