this post was submitted on 25 Jun 2023
100 points (85.7% liked)
Linux
48144 readers
929 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
NixOS needs what is IMO the killer feature of Arch: the wiki.
Comprehensive documentation on not only the OS but the additional packages that we use is what drew me to Arch, and the thing that makes me swear in frustration whenever I have to use Ubuntu/Debian.
NixOS is an excellent OS that has the promise of being every bit as hackable as Arch, but far more stable. Problem is, configuration is very different and needs extensive documentation to reduce that friction point.
The Arch wiki is pretty distro-agnostic (barring package names and
pacman
specific stuff). I've been distro-hopping for past decade and I've always used it as a reference for setting things up.It's distro-agnostic because Arch does very little to modify packages when they're put in the repos, which means they'll line up with the packages own man page & readme. The issue comes when opinionated distros modify things like command syntax, etc file locations and default behaviour.
If NixOS is similarly unopinionated, it'd only really have to document its own system layer, but my point is that Arch being guaranteed to reflect a well documented system is what drew me to it.
The way in which NixOS works in regards to packaging, locations of config files and others makes it very opinionated imo. You have to do it the nix way and trying the "normal" way doesn't work in most cases.
Nothing wrong with having a canonical way to configure things, but if it's not excellently documented people are going to try doing it the wrong way and get frustrated.
NixOS has a killer feature which obviates a wiki for most such purposes: NixOS options. They document themselves!
You don't need to look up a wiki on how to install and enable i.e. paperless and all the other services it depends on, you simply set
services.paperless.enable
and NixOS configures everything for you internally.The option tells you roughly what it does internally and the other options provide pointers for things you might want to tweak about it. The
services.paperless.extraConfig
option for example tells you how to configure it (pointing to upstream documentation in this case) and even gives an example on what you might want to do.Another example is how to install Steam. In Arch, the wiki must tell you all the manual steps required to enable multilib, install the steam package, install 32bit dependencies, yada yada.
In NixOS, you simply set
programs.steam.enable = true;
. Off to your games.You wanna customise the Steam package to add additional flags, pass env vars or add additional packages your weird Linux-native indie game needs?
programs.steam.package
tells you how to do that right in the place where you do it.While you're looking for
steam
, you might also come acrosshardware.steam-hardware.enable
which you need to set in order to make your Valve Index and Steam Controller work properly.You wanna start Steam in a gamescope session right from the display-manager?
programs.steam.gamescopeSession
does it for you. No need to copy paste some snippet that you'll instantly forget about and maybe breaks in a few months.programs.steam.gamescopeSession
is maintained upstream by NixOS, so if it breaks, someone will go and fix that and nobody needs to adjust any of their copy-pasta because they'll just update as they always do and it just starts working again.None of this is perfect yet and the quality of documentation of NixOS options really varies but I think you get the idea here. I already rarely look at the NixOS wiki to configure my system because the system configuration tells me what I need to do already and this will only get better as options get refined.
I don't think it makes that promise and I don't think it's true.
NixOS is about doing things "properly"; applying software engineering to software environment management.
Whipping up a quick hack is much more complicated and time intensive on NixOS than doing so on Arch because it's way more abstract. You can't just quickly replace some binary with your own compiled one, you need to use NixOS' systems to wire in the binary and build it with Nix to begin with.
Maintaining a system (even one with terrible hacks) is much simpler in NixOS however.
You're underrepresenting the complications of NixOS and overrepresenting the complications of Arch. For example, to install Steam I would run
sudo pacman -Syu steam
. On a typical Arch setup that's all that's needed.And that's why the Arch wiki is so great - it has details and links about everything that goes into making something work. If you want to learn more or if something goes wrong it's all right there.
But yes, I think you hit the nail on the head at the end there - hackability is Arch's strength, everything is exposed and flexible to tinkering. It's easy to make almost anything work, and easy to learn how it works. That's very different from NixOS's core philosophy of stability and reproducibility.
There are inherent pros and cons to both approaches - it really comes down to a mix of personal preference and using the right tool for the right job. They're apples and oranges, and the article framing NixOS as a superior successor to Arch is as silly as the reverse would be.
That is incorrect to my knowledge. Back when I used Arch, you still needed to enable multilib which I don't think has changed. You need a wiki entry to tell you how to do that.
AFAIK you also need to manually install yourself a Vulkan driver. I've recently helped a person who had opted for AMDVLK here and it broke in one game but was working fine in others.
That sort of thing doesn't really happen with NixOS because enabling desktop support implies the presence of a Vulkan driver and we provide a sane one by default (currently RADV via mesa or nvidia when you enable proprietary drivers).
Didn't read past that as you clearly don't understand what the differences between documentation, a tutorial and code comments are.
Do read past that and you might understand why NixOS options are a type of documentation. They're not "code comments".
I have tried NixOS, the documentation in many options is subpar. Only the most interesting packages get good documentation. I'll give NixOS a few more years until I try it again, but currently it's rather a hobbyist and 'tinkerer' distribution. Which is fine, but I don't want to learn domain specific stuff which is different from all of the rest of Linux.
I installed NixOS on a laptop and tried to run a steam game and it just straight up didn't launch anything, went to the wiki to figure out the amd drivers, opengl whatever put like 10 new lines in my nix config rebuilt restarted still nothing works, after about 2 hours i just swapped back to arch and the games launched straight away, so for me it wasnt as easy as you may claim it to be. I also tried it on my desktop before and it was a better experience, but still not great. The nix config file is a bit of a mess of options that you have to dig into wiki pages and searching stuff to figure out how to get some stuff to work
If you're on AMD, all you have to do is
programs.steam.enable = true;
. Not dozens of lines copied from some wiki. I should know because that's all I do in my config to enable Steam on my AMD system: https://github.com/Atemu/nixos-config/blob/450bf3710c77818436f1459e3ea36bf087b6e56b/configs/HEPHAISTOS/default.nix#L16 (L17-L29 are optional customisation).What may or may not work is doing everything
programs.steam.enable
does internally yourself like some outdated wiki entry might suggest you to do. Given you claim to have been manually configuring opengl stuff for instance, there's a good chance that's what you did. You do not have to touch any opengl settings or putsteam
intoenvironment.systemPackages
.The entire point of NixOS modules is that we have the capability to abstract stuff like this so that you do not have to copy pasta dozens of lines from a possibly outdated unofficial wiki but can simply set one option.
Im like 99% sure i did have that line in my config, and it still didnt work for whatever reason.
Look im not saying NixOS is bad, in fact i really like the idea of it, but ive tried it about 2 times and always came upon something that didnt just work for me, and i end up going into the nixos search thing to try and find what variables i need to put in my config, and its not always 100% clear. On my desktop steam and everything worked fine but i was annoyed at some stuff and stopped using it, on my laptop it just didnt wanna launch any games, idk why exactly that happened but another distro worked fine.
No, you're holding it wrong. Should've looked at the options! 🤡
Having options is not the same thing as documenting those options; well outlined documentation doesn't just dictate how to do something but also points out what you may want to do i.e. filling out unknown-unknowns.
Just because NixOS makes for an excellent DevOps template doesn't mean it can't also be an excellent platform for hacking together random crap. I understand that NixOS advertises itself as the former, but when I say "promises to be" I don't mean "makes a promise to be", but "has promise for being".
Features like: a common configuration interface, safe rollback, atomic changes, nixos-hardware all are features that enable developers to safely hack together solutions, and then have an excellent log detailing what they just did.
Agreed. The point is however that, with NixOS options, you do not necessarily need such documentation for unknown-knowns.
With many things however, we can simply delegate to the upstream documentation for some thing. See i.e. the paperless extra config example. We don't need to tell users how to configure their paperless, we just tell them that any upstream option goes into this settings option as an attrset.
NixOS options do to a degree fill out unknown-unknowns though, see I.e. the steam-hardware example. I've stumbled upon many handy options by searching for related options.
While the initial "hacking the crap together" phase is indeed harder in most cases, maintaining these hacks is much simpler thanks to overrides/overlays and the additive nature of NixOS options.
That quality can arguably make it "excellent" too.
Yeah true, whenever I have problems with some packages like Wayland and its alternative Xorg tools or games, its Arch wiki that helps extremely to fix or understand the situation. Its like many experiences are combined and written in a simple language everyone can easily understand.
On Ubuntu for example, everything feels like its hardcoded, not the standard and its just not even documented. And the wiki has minimal info about the packages.
Fully agreed- I experimented with it around November of last year and absolutely love the idea of it, but the documentation just isn't there. At the time I found nothing explaining flakes in a clear and concise manner so I had no idea how to use them or add them into my configs. People online kept saying to port the rest of my configuration to flakes but all of the examples online were complex and there was no simple example to build off of. I ended up settling for Universal Blue since it just uses OCI containers and I don't need a PhD to have a pseudo-declarative environment in it, but would love to revisit NixOS if the documentation ever gets better.
Yeah if your knew to nix its even hard to figure out how to install a simple package.
I mean, it can be, because there are 3 different ways on NixOS:
configuration.nix, to have it installed for all isers and have it saved in the configuration so you can reproduce it.
nix-env, which installs it locally for the current user and doesn't save in the configuration.nix
nix-shell, to install this package in a temporary shell, so the package is never really installed on your system, it's just there temporarily, until you exit that shell session.
The Nix package manager got ported to OpenBSD, so that part of NixOS must be excellent.
I'm surprised, and really pleased; I was under the impression that Nix required Systemd, and was thus a Linux exclusive. Good to see
Nix (the package manager) does not depend on systemd in any capacity; just like apt, apk or Pacman do not depend on systemd.
NixOS currently uses systemd and cannot be ported without major restructuring. So far the enthusiasm to do that has been very limited. InitWare may be the path forward but that project seems to have stalled.
Note that NixOS also does not support any kernel other than Linux either.
It is also available on macos
Nixpkgs is, but not NixOS.
Note that, while the Nix package manager can technically run on OpenBSD to some capacity, that doesn't mean packages in Nixpkgs are compatible with OpenBSD.
I can't comment on the current situation from first-hand experience but I can say that there is no support guarantee as there is for Linux and macOS and that there is no binary cache either. You have to build everything yourself and I'm not even sure we can build even basic packages such as
hello
on BSDs yet.OpenBSD has no intention of trying to use Nix packages, my point was that the Nix package manager has useful enough features and functonality that it was ported to OpenBSD to use for managing OpenBSD software and packages.
That's what porting does, it's making a program fully functional on a different operating system or different hardware architecture. Compatibility serves a different purpose from porting.
My point was that support for BSDs in Nixpkgs (which is the de-facto "standard library") is still in its infancy. Nix without Nixpkgs is like C without a libc.
Terminology on this is a bit loosely defined. What I meant was that the packages in Nixpkgs largely haven't been "ported" to BSDs yet.
Many of the packages might already be "ported" and would work if other packages lower down in the tree worked. In Nixpkgs we don't really differentiate between fixing packages so that the package works as upstream intends or making something work that was never intended to work.
There is zero interest in Nix pkgs, that's all Linux stuff. Every and all Linux packages is incompatable with BSD, and there is no way to make Linux packages ever compatable with BSD.
To port Nix package manager to BSD they change the source code to run on BSD libraries, look for BSD compiled programs, and how run on BSD dependancies, interacting with a BSD kernel.
Installing Nixpkgs on BSD is the same as talking about making Mac OS programs run on Linux, that's physically impossible.
OpenBSD is not trying to run the whole Nix distribution, they only tool the Nix package manager and changed the source code of the Nix package manager but removing all referances to Nix and Linux, changed the code to run on BSD libraries and changed the Nix package manager source code to look for BSD format files.
Nix package manager on OpenBSD has no knowledge and no understanding of Linux or NixOS files.
I may not have been precise enough here with the wording.
To clarify: Nixpkgs is a source distribution. You can see all of it here: https://github.com/NixOS/nixpkgs
From Nixpkgs, Hydra builds binary artifacts which then get distributed through the binary cache (cache.nixos.org). Users usually use binaries substituted by the cache but these binary artifacts are a direct result of the source, a small set of parameters (mainly platform), some time and some energy, so we usually rarely talk about them. They're not interesting to us; we could reproduce them at any time by just building again.
What I'm talking about all happens at the "source" level, not the binary level. You obviously can't take a Linux binary to a BSD and expect it to run but you can take a package definition initially made for Linux, try to build it on a BSD and run the result of that.
From experience with Darwin, this works in the majority of cases and usually only requires very few adjustments to the build recipe. With Nix, we have a full expression language at our hands, so we are able to to things like optionally adding some dependencies depending on the platform. We usually do not maintain separate build recipes for separate platforms; they usually use the same build definitions with different parameters.
What do you mean by this? OpenBSD "forking" Nix (a la Guix) would be news to me. Do you have some links for me?
The Nix package manager has no knowledge or understanding of "Linux or NixOS files" on any platform, including Linux/NixOS.
Its purpose is to know how to evaluate and realise Nix expressions.
I can evaluate a Nix expression for OpenBSD on my macOS machine. Nix doesn't care.
(Obviously I can't build it but I could theoretically cross-compile it, if support for that was to be wired up in Nixpkgs.)
I think you're misunderstanding a bit how Nix and Nixpkgs work with different platforms.
In the OpenBSD ports and packages tree for user installation here
I think NixOS needs an approachable installer or config builder
I'm new to NixOS, just installed it a few days ago, so I can't say much about it's pros and cons, but the installer was easy and I installed and booted into the new system very quickly. I think it might have been udpated in the past year, because I am watching a tutorial video from a year ago and he installs it via command line from the live iso.
edit: it also gave me a default configuration.nix which I've just been adding to (to get nginx with letsencrypt running, plus extra packages I wanted installed)
These are pretty good points.