16
What do you like about your Linux Distro?
(feddit.de)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
I like that the NixOS packaging system feels like it's build for Free Software, making source code and Git repositories a first class citizen. You can simply drop a flake.nix into your repository and turn it into a Nix package within a couple of minutes, that's quite a bit different than the utter headache it is to package something for Debian. Nix packages being free of naming conflicts also makes it very easy to mix and match whatever versions you need, something that's basically impossible on most other distros unless you resort to containers or virtual machines. NixOS having the largest package collection of any distro is a plus too.
Can I use a file in the same place as the nix config to set the configs for i3 for example? Or anything else that would go in ~/.config? It would be amazing to have all the configuration files in one single folder to easily move to new hardware.
Yes, that's what home-manager is for, your configuration goes into
~/.config/home-manager/
and from that you can generate all the other configuration files that go into your$HOME
(either by just copying a read-only version of the raw file or by generating it on the fly from the nix configuration file when a home-manager module is provided)How different (if at all) does Nixos feel as a daily driver, if at all? Is it only about getting used to the system, or does it require to do everything the Nixos way?
Also how does user-level configuration work? Does the upgrade system just ignore your $HOME in terms of version control?
You use a 3rd party tool called home-manager for this. It provides about the same experience as the system config and has more configuration options for software, so should be preferred when it makes sense.
Overall, it's great if you're Linux-savvy and is one of the few distros that is legitimately innovative. Said innovation can also be a pain in the ass on occasion though, but still worth it.
All OS configuration (i.e. your installed packages, services, /etc content) happens in NixOS via a single configuration file in
/etc/nixos/configuration.nix
. When you donixos-rebuild switch
that file gets read and the OS gets rebuild, which in practice means some downloading and changing some symlinks, so it's reasonably fast, kind of like GNUstow
. The partition table isn't touched here, that has to be setup manually on the first install like on every other distribution. NixOS will also not rollback the file system if you decide to boot into an older version, everything is done by symlinks and environment variables, so you don't have to worry about your $HOME disappearing or anything like that.For daily use that means that you basically never edit anything manually in
/etc
ever again, except for that one NixOS config file. You also can't since everything will be symlinks into a read-only/nix/store
. For permanent package installation you also need to edit the file and rebuild, you can't do imperative stuff likeapt install ...
. However with NixOS you don't need to permanently install anything if you just want to try it, you can just donix run nixpkgs#emacs
ornix shell ...
and it will run it without installing it (everything goes to the/nix/store/
cache and is garbage collected when no longer needed).This can become a problem when you are dealing with third party packages that come as self extracting installer files that want to install themselves in
/usr
or depend on programs being available as/usr/bin/python
or whatever, since on NixOS that whole hierachy is empty ( except for/usr/bin/env
and/bin/sh
). NixOS hasbuildFHSUserEnv
to work around that and provide apps with a normal looking Linux filesystem, but that requires a bit more effort than the usualcurl http://.../install.sh | sh
hack.By default
$HOME
isn't touched at all and will behave largely like on any other distribution. You can however install packages as user vianix profile install
(which behave much the same asapt
would, but is local to your $HOME). The other popular alternative is home-manager, this provides basically the same what/etc/nixos/configuration.nix
does, but for your $HOME, so you can start systemd services, generate your bash profile with it or install apps locally in your $HOME. Home-manager has to be enabled manually and is probably best ignored until you are familiar with the rest of the system. Home-manager is also less all-or-nothing than NixOS itself, so you can freely chose which dotfiles you want to manage manually and which you want to generate via home-manager.As for nitpicks when it comes to daily use: Due to everything in NixOS being fully reproducible, NixOS makes little to no use of binary compatibility, meaning if
libfoo
changes, everything that depends on it has to change too. This requires a bit more downloading than other distributions. After an upgrade, NixOS will also keep two copies of everything around until you garbage collect them. This allows you to just go back to an older version via the boot manager. But it also means that you might need two or three times as much storage as on other distributions, at least until you garbage collect. But generally that's a worthy trade-off unless you are on an extremely resource constrained system (anything >=32GB storage should be fine).Finally, if in doubt, install the Nix package manager on whatever distribution you are using right now. You don't have to go the full NixOS at once, you can install Nix packages on any Linux distribution and play around with it, similar to flatpak.
Thanks for this write up.