Organizing your Nix configuration without flakes
17 points by knl
17 points by knl
The writer of the article forgot to mention the best part of flakes: caching.
We've implemented precise eval caching for https://devenv.sh and made a bunch of optimizations so if your definition of environment doesn't change, you enter it in less than 100ms.
That's a crucial feature of development environments and flakes get it completely wrong :)
See https://devenv.sh/blog/2024/10/03/devenv-13-instant-developer-environments-with-nix-caching/
sometimes it feels like every module structures everything a little differently
Before flakes this was the norm and every repo you drew in did whatever.
It was the norm to have somewhere an import <nixpkgs> { } or fetchTarball inbetween and evalled another nixpkgs.
The example of npins even promotes this anti pattern and nudges people into make their nixpkgs input not overwritable and pinned which for many repos is unnecessary and just makes you use another set of (outdated) dependencies. https://github.com/andir/npins/#quickstart
All the other tools don't solve peer dependencies consistently.
Also, flakes forbids you from calling <nixpkgs> which depends on channel (via env variables and NIX_PATH). This is also doable on basic nix but not the default. Depending on channels was such a PITA to me at first (not understanding why evaluations on 2 different machines gave different results). I think people wrap their nix builds and override NIX_PATH to make it fail to depend on global env.
Also agree that flakes schema is a bit lacking.
hey that's me :)
Personally I like flakes, but I would like to see improvements and it kinda seems like they're languishing these days. I'm not sure what the plan is for flakes in Lix, but I'm really open to anything that works well and is at least somewhat decentralized.
There's a lot about the flake schema that I like, despite the limitations and I've really enjoyed working with flake parts modules lately. This post is an interesting combo!