this post was submitted on 08 Jul 2023
88 points (92.3% liked)
Linux
48364 readers
1753 users here now
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.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.