this post was submitted on 08 Jul 2023
105 points (94.1% liked)

Linux

48074 readers
749 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

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I use Fedora 38, it's stable, things just work, and the software is up-to-date.

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

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.

[–] [email protected] 7 points 1 year ago (2 children)

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?

[–] [email protected] 16 points 1 year ago* (last edited 1 year ago) (1 children)

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 do nixos-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 GNU stow. 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 like apt install .... However with NixOS you don't need to permanently install anything if you just want to try it, you can just do nix run nixpkgs#emacs or nix 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 has buildFHSUserEnv to work around that and provide apps with a normal looking Linux filesystem, but that requires a bit more effort than the usual curl 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 via nix profile install (which behave much the same as apt 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.

[–] [email protected] 5 points 1 year ago

Thanks for this write up.

[–] [email protected] 4 points 1 year ago
  • Largest repos of any distro, so package availability is good (also supports Flatpak).
  • All package installation and configuration is handled via config files, so it's easy to keep track of what's installed. Also makes re-installation convenient and easy (this is also great if you're fond of unixporn-style setups).
  • Because it uses config files to manage this, you can also take advantage of VCS.
  • Instead of having to work with several shitty DSLs to configure your system, now you only have to use one!
  • Being able to install multiple versions of the same library is nice. With Nix you can just install whatever the fuck you want, really. Want to use DisplayCAL, but can't because it was dropped from the current release's repository for still depending on python 2? No problem, just have your flake pull it from a previous release when it was still in the repos; it'll just work because builds are done in isolation.
  • The generation system makes updates fearless, since if something breaks you just rollback.
  • Development is both better and more annoying. There's no FHS, so you have to set up a dev environment with a flake every time you want to do a project. This is nice because you don't miss dependencies as everything has to be explicitly laid out in the flake and other Nix/NixOS users can share your flake and get the same exact dev environment (kiss "it works on my machine" excuses goodbye). Annoying both because you're required to put in more forward planning with your dev environment and also because it breaks language-specific package managers, so you're limited to supported languages.
  • You can't just git clone/make/install stuff from GitHub, as there needs to be a flake first. If the software already has one included, great! If it doesn't, you'll be making it. If you need a dependency that currently isn't packaged for Nix, you'll be making more than one. If the software is difficult to package, god help you.
  • Nix documentation can be really lackluster and also assumes you're Linux-savvy.

Also how does user-level configuration work?

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.

[–] [email protected] 5 points 1 year ago (1 children)

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.

[–] [email protected] 5 points 1 year ago

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)