5 ms·
It's not based on another distro, although I guess its closest cousin would be Gentoo, which is another source-only distro. By default everything in NixOS is co
by village-idiot 8y ago
It's not based on another distro, although I guess its closest cousin would be Gentoo, which is another source-only distro. By default everything in NixOS is compiled from source, but they use some novel techniques to reduce duplication, and you can setup binary caches for your workplace if you wish.
Edit: apparently packages are distributed in binary by default, but if you customize options it’ll be compiled locally. My mistake.
NixOs is the amalgamation of 3 things: Nix, Nixpkgs, and the other bits it takes to make an os.
Nix is a programming language and a packaging tool. It allows packages to be programmed in a type safe way, then executed to install the actual libraries or binaries. This is the area of the system that I actually know the least about.
Nixpkgs is a large collection of packages for Nix. The community really has worked on this set of stuff like gangbusters, it's quite impressive how many things they've wired in from scratch. Each package specifies its dependencies, and the various options it accepts to tweak various options. A good example would be setting the data directory for the postgresql service.
NixOs combines the previous two items along with the other bits it takes to make an OS work. So they provide official installation instructions and media, configure how Nix is going to actually be run on NixOs (as compared to say, OSX), provide stable channels for various versions, etc. Basically all the regular things you expect out of a distro.
Personally, I'm not exactly sure if this is where Linux is going to go, but I think that this is how Linux would have been built if disk was much cheaper back in 1970ish. A lot of the regular problems of systems management are completely solved in NixOs.
Need two different versions of the same shared library? No worries, they can each have their own copy, and Nix will automatically make sure the correct one, specified by the hash of all the build flags, will be the one that's loaded into memory for said program.
Have a shared system? Great! Users can install userland programs without root privileges. Because items are inserted into the nix store idempotently and paths are not universal, I can install vim without any other users seeing that, and without root. The only thing that takes root privileges are services (e.g. Postgres), or installing programs for universal access.
Sadly this does come with some downsides. A lot of programs over the years have come to make very bad assumptions about program location, or the ability to modify the PATH variable. A good example of this issue is RVM, which for the life of me I could not get to work.
- mbrock 8y agoJust a note: with a normal installation, NixOS will basically never compile anything on your computer, unless you customize a package or use a very recent revision of the package tree that hasn't gone through the build server yet.
- secure 8y agoCustomizing packages is something I do occasionally to debug FOSS. I don’t recall which package I wanted to debug, but I remember that I gave up after my laptop was compiling for many hours. Any changes to one NixOS package automatically invalidate all of its reverse-dependencies, which isn’t the case with e.g. Debian, where I can, when deeming it safe, rebuild a package and install it over the currently installed version.
- mbrock 8y agoYeah, although you have a lot of flexibility regarding how much of your system will be rebuilt. Like, if you add a little patch to libpng as an overlay over your entire system, then you'll recompile a lot of stuff, but you can also choose to only use that custom libpng with a specific package. Even in the latter case, it's true that Nix will always recompile the package that depends on libpng, instead of using dynamic linking and only recompiling libpng. This is because Nix has no way of knowing how your libpng patch will affect its reverse dependency, and because link paths are always content-addressed in Nix for reproducibility.
- secure 8y agoIt wasn’t apparent to me from the docs (back then?) how to use the custom libpng only with a specific package. Do you have a pointer to the documentation on that please?
- Ralith 8y agoYou just pass it in explicitly: https://nixos.org/nixpkgs/manual/#sec-pkg-override https://nixos.org/nixpkgs/manual/#sec-pkg-override