Flakes also are a symptom or cause of much intra-community strife between “pro-flakes” and “anti-flakes” factions, but this situation is at some level a sign of broken consensus processes and various actors trying to sidestep them, an assumption by many people that the docs are “outdated” for not using flakes, and the bizarre proliferation of flakes everywhere in blog posts or tutorials leading to a belief that they are required for everything.
This post is about how to architect Nix projects in general, with a special eye on how to do so with flakes while avoiding their limitations. It tries to dispel misconceptions that can develop in such a monoculture.
↫ Jade
Every time I hear about Nix and Flakes I feel like I understand all of it a little less.
Thanks for posting this Thom.
As I read more paragraphs I find myself asking two pertinent questions:
1) What the heck is a flake?
2) What the heck is nix?
I gather there’s some kind of debate in the nix community about flakes, but the article seems to assume the reader already knows what all of this means. I almost thought this article was referring to derogatory slang…
https://en.wikipedia.org/wiki/Snowflake_(slang)
Alfman,
I tried to skim the article, but could not understand what nix was.
Is that an operating system similar to CoreOS where you’d have a “functional definition” with a read only root?
I’ve never used Nix, but as far as I understand it, it’s a package manager on steroids (https://nixos.org/explore). I think part of the goal is to easily create containers that can be deployed anywhere. Flakes are the configuration files. I have no idea why they’re called Flakes, though.
It seems interesting, but nothing that I personally have a use for.
Nix is a Linux OS Distribution, and also with its own package manager also called Nix.
> Nix is a Linux OS Distribution, and also with its own package manager also called Nix.
No, it is not. This is totally wrong. Please do not try to answer unless you *know* that you understand, because that is how misinformation spreads.
Nix is a package manager which uses a functional language to work out dependencies — which means it can manage them much more effectively than existing package manager, where humans have to do a lot of the work.
Nix can run on any Linux distro.
NixOS is Linux distro _built entirely with Nix_ as a sort of proof of concept.
But Nix does not need NixOS. NixOS is built on Nix, but Nix does not use NixOS at all.
To clarify some of the questions below.
Nix is a Linux Distribution. It uses a descriptive configuration. Basically you describe the ENTIRE system configuration in configuration files and the system is built to that configuration. You never actually configure, install, or touch anything in the operating system outside of the descriptive configurations, and then each time you rebuild the system. This makes the exact system install repeatable and easily copied.
It is also immutable, and you can rollback to almost infinite previous versions. Each time you make a config change, an entire new version of the system is built.
It has a couple of other interesting features, such as the fact the software is all installed in a private tree so each user can have their own versions of any software on the system installed just for them.
But those are the basics.
Personally, I tried it for awhile, gave it a fair shake, and in the end decided I don’t like it for a desktop user system, and went back to Arch.
> Nix is a Linux Distribution.
Again: no it is not.
You are mixing up NixOS and Nix.
NixOS is the distro:
https://en.wikipedia.org/wiki/NixOS
Nix is a distro-independent cross-distro packaging system:
https://en.wikipedia.org/wiki/Nix_(package_manager)