9.5 Flake inputs in depth: follows, flake = false and lock file size
Lesson 63 of 68 · 20:21
Video chapters
-
0:00 Introduction to Flake Inputs
-
1:58 Multiple Inputs and Private Git Repositories
-
4:17 Flake Dependencies and Lock File Growth
-
9:08 Using follows to Deduplicate Inputs
-
13:10 Why follows Does Not Replace Overlays
-
17:28 Lock File Changes and Trade-offs
Transcript
Introduction to Flake Inputs
0:00 Okay, so let's discuss Flake Inputs now. What's interesting about Flake Inputs is that of course you can have multiple of them and then you can have each of them follow each other to save some space and so on which has caching implications and other side effects but also many people think that you don't need overlays if you have the follows feature which is kind of wrong because overlays are much more powerful. So let's discuss what Flake Inputs can do and what they can't.
0:31 So, in general, you can say okay we have seen that part already. Most Flakes will always import some form of Nix packages, and then you can select the branch, whatever. Of course you can also import other Flakes. What's interesting is that we're not only supporting Git, but when we are supporting Git we can do that via HTTPS or via SSH. And that is especially relevant when you start to use some kind of like internal GitLab or whatnot, then in your company, it might be necessary to define how to authenticate against private repositories because those cannot be checked out like public repositories without authentication.
1:16 So it already starts being complicated. How do you even line up your inputs for like company scenarios or intranets? Of course it's easy. You have Git HTTPS and Git SSH and of course your Nix user basically and/or the daemon when you regard the builders later. They need to be able to authenticate if that is private, but you will be able to fix that anyway. That's not really a Flake thing at this point. What's much more interesting is that when we depend on multiple Flakes, we'll now have inputs Nix packages, inputs some Flake and input other Flake of course.
The full transcript comes with the lesson.
About this lesson
Flake inputs look simple until your flake.lock starts pulling in the dependencies of your dependencies. In this lesson we measure what each input really costs on a real project, then take control with the follows mechanism and flake = false. You watch a lock closure double to 400 MB and shrink back down.
In this video
- Measuring input sizes with
flake-du, and how one innocent-looking input change doubled the locked closure - What
inputs.x.followsreally does, drawn as arrows between flakes that you learn to bend in both directions flake = false: treating an input as a plain folder and ignoring its lock file entirely- Why
followsdoes not replace overlays, and which one you need to inject security patches across a dependency chain - The trade-off nobody mentions: redirecting another flake's nixpkgs costs you their cache and their test guarantees
After this lesson
You can read and reshape any flake.lock, keep it small on purpose, and explain to your team when follows helps and when only an overlay will do.
Builds on: Anatomy of a flake: inputs, outputs and the lock file (9.2)
Links: