I’ll chime in just for a moment to say I see surprisingly little disagreement in this thread compared to how much communication traffic is happening here:
- Yes flakes are used a lot, which is unsurprising given the amount of advertisement and advocacy dedicated.
- Yes it would be disruptive to somehow “kill flakes”, as it would be disruptive to abruptly discontinue any sort of legacy tool or interface. We shouldn’t do that
- Yes there doesn’t seem to by any need whatsoever for flakes to live in “The Nix” code base. It’s always seemed peculiar that flakes aren’t just an external tool, and it seems the weirder now that there’s so many alternative implementations of Nix which could all be used as “backends” for such a tool…
My hindsight opinion regarding flakes (I discovered Nix much later when they were already a thing) is that I think we do have technical problems that flakes could have solved but they haven’t, and I think there is a UX problem that they do solve, but solve poorly, and the way they do they should not have required a single extra line of C++ in “The Nix” implementation.
Specifically, I think the two technical reasons we need something flakes-like are:
- A dependency injection system for composing out-of-tree projects without creating combinatorial explosions (addressed by
inputs.<name>.follows
but poorly)
- A user interface for pure/hermetic evaluation
The UX issue is merely the lack of an established protocol: so a project (say disko or SNM) exposes a bunch of nixos modules, how do you figure out where are the entry points. This is simply a matter of convention: ok our top-level attrset will have this map nixosModules
, and attributes under that would be of type you can include in imports
. This doesn’t require any special features in Nix the store, the interpreter…
Technical issues flakes do not address (but maybe the misleading documentation convinces people they do):
- Exposing packages or package sets. At least this is my interpretation of tomberek’s FOSDEM talk on “units of compositionality”
- Composing out-of-tree projects in a configurable way. Cf. e.g. the “nixpkgs config should be a flake input” issue
Issues that are addressed by something other than flakes, but flakes take the credit:
- CLI UX. The nix3-command really is an improvement over the previous generation. I’ve taken on to use
nix build -f "<nixpkgs>" ...
over nix-build
or over nix build nixpkgs#...
. Nix3-path-info is much less confusing than nix-store (still not without flaws). Note that nix build -f "<nixpkgs>"
still supports configuration using --arg
. It’s mostly profit and virtually no loss? I suppose the nix-command
wasn’t stabilized just because the implementation was entangled with with flakes? And it still does feel odd that it’s part of “The Nix” code base rather than external, but ah there’s always nits to pick.
I find it very ironic that this thread is comparing detsys Nix to devenv: an external CLI tool that wraps Nix[^1], and in case of the “Determinate Nix” an external daemon that “drives” it. That’s what flakes could’ve been, and maybe still can. That’s how we could integrate a more complex build scheduler too: by making it external…
Trying DetSys Nix, devenv
I apologize and I don’t mean to be mean but I have to say: Discord, lol
EDIT1:
[^1]: I hope I’m not misrepresenting devenv? I’m not closely familiar
EDIT2: Maybe worth mentioning that I do think there’s potential benefit to implementing lock-files outside nix-lang, and specifically in an external “dependency injection” system for reasons similar to those concerning evalModules
, but this is a discussion for a separate thread