3 ms·
It's important to note that Nix(OS) is really 3 things: A functional language, a package manager and an operating system. I switched all my desktops and lapto
by the_duke 6y ago
It's important to note that Nix(OS) is really 3 things:
A functional language, a package manager and an operating system.
I switched all my desktops and laptops to NixOS at the beginning of the year, and I'm starting to use introduce it at multiple companies for data science / ML work environments with full reproducibility and Kubernetes bare metal deployments.
Main benefits:
* pure build system
* extremely easy way to set up and switch between custom environments with their own sets of dependencies (nix-env, nix-shell)
* nix (the package manager) is cross-platform and works on MacOS and other Linux distros (although that's not always smooth sailing...)
* Ephemeral environments that are quickly set up and torn down, like the `nix-shell --packages vlc --run "vlc https://dash.nixcon.net/dash/master.m3u8 https://dash.nixcon.net/dash/master.m3u8"`
* (mostly) fully reproducible OS and user environments
* patching and/or locally building dependencies without ending up with a messy system
I can now finally get a (almost) 100% reproducible user environment including hardware configuration (kernel modules, disks, ...), installed packages, configurations, ...
home-manager [1] even enables declarative configuration of things like VS Code/Vim/Firefox plugins, and provides statically typed configuration options for many applications. The package repo is also very comprehensive.
For manually managed servers that aren't just bootstrapped from VM/cloud images the benefits are also wonderful.
It's definitely not all smooth sailing though:
* There is documentation, but it's spread across a lot of pages, disorganized and sometimes quite outdated or incomplete. I often have to read the source code - which is also mostly undocumented.
* Running unpackaged software: you can't just download binary releases and run them, unless they are fully statically linked (like most Go binaries). Instead you either have to whip up a package definition, or manually try to get the binary working (eg with patchelf)
* The language is somewhat quirky. As often the case with such niche languages, documentation and tooling are very subpar and debugging is not exactly a joy. I wish Nix was built on a more common language with good tooling around it. I bet it would be quite a bit more popular, due to the lower barrier of entry. You get used to it though if you are willing to put in some effort.
* Package ecosystem: the package repo is really comprehensive, but maintainership for some less popular ones is not up to Arch + AUR levels. Also the auditing for a lot of the packages is very limited. For any security critical environments or server deployments I would definitely limit myself to a hand full of core packages and/or be prepared for manual auditing. I wish the repo was split up more like Arch into core and community, with different guarantees for auditing and maintenance. (the Flakes effort will hopefully help here quite a bit)
All in all Nix is great though, and it's impressive how stable and featureful the ecosystem has become, despite being somewhat of a niche "product".
[1] https://github.com/nix-community/home-manager https://github.com/nix-community/home-manager