this post was submitted on 12 Oct 2023
2 points (100.0% liked)

NixOS

930 readers
1 users here now

NixOS is a Linux distribution built on top of the Nix package manager. Its declarative configuration allows reliable system upgrades via several official channels of stability and size.

This community discusses NixOS, Nix, and everything related.

founded 1 year ago
MODERATORS
 

I've been hearing a lot about it lately and I'm intrigued, but also utterly confused.

Is this a Linux distro I'd install on bare metal because it offers a new way of package management that addresses the issues other distros have?
Is it something I install in the distro I currently use?
How does it work and what does it do?

I've tried to read https://nixos.org/guides/how-nix-works but the first sentence is

"Nix is a purely functional package manager. This means that it treats packages like values in purely functional programming languages such as Haskell"

and that's where it lost me. Thanks for helping me understand!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago

Ok, heres my run down:

Nix is a package manager with the goal of making it so that when you install a package at a version, you always get the same thing.

But isn't that how all package managers work? Not at all. Most software requires other software to work (dependancies). Those dependencies also have dependencies, and so on. If a version of the dependency changes between installs, your package works differently. So Nix forces the package to specify what version of the dependency to use.

But version numbers are pretty wishy-washy, so nix actually requires git commits. This is good, since it turns out, the compiler and libraries used to build the software are dependencies, too. Building with a different compiler can change the way the package works. So Nix forces the package to specify how to build it also.

So Nix is a package manager where each version of a package is built against a known compiler, and comes bundled with a known set of dependencies.

This allows some cool things, like generations. Change your list of installed packages (or configuratian, it handles that too), nix can save the old config and instantly go back to it. No more bricked linux install (if it can get past the bootloader). Also lets you do os-level per-directory installs. Have two projects that each need a different version of c compiler or postgres? Nix makes that easy. Want to make sure all dev machines in your project have the same python version? Just check in the config.