this post was submitted on 08 Mar 2024
194 points (94.5% liked)
Linux
48178 readers
1541 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
Thanks! I saved the comment for later.
What advantage do you see in Nix compared to Distrobox?
I personally enjoy DB because of its simplicity.
I just open BoxBuddy, create a new container from the dropdown-list, and then just start using my Debian or Arch container on top of Fedora Atomic for example.
The two main benefits I see in Nix are the reproducibility and the big repo. But in case of the repository size, Debian and Arch (+ AUR) are extremely big aswell.
Are there any other big benefits, that I can't get with Distrobox, but with Nix?
Just as a small side note, I'm no power user and tend to use my PC more like a casual guy.
I haven't used distrobox, so take this with a grain of salt:
reproducibility: if you copy my nix files, the
flake.lock
will ensure you have the exact same results as medeclarative package management: you make a list of packages and the declarative nature forces you to keep it up to date at all times, that's how you install/remove them. On arch you need to
-Syu
the package and remember to add it to an installation script (I never did). This also allows for easier maintenance because you don't need to go through random dependencies to find an unused package you've installed (~100 packages on the list == almost 2000 packages installed). If there's a distrobox version of a Dockerfile, you can do the same but it will most likely have the same disadvantages.home-manager allows you to configure packages (usually not worth it though)
no need to export packages, when you install them they're immediately available in your main distro
combine these and you have an extremely simple setup to distrohop, or work on multiple devices. You can also for example break off certain packages in a separate module, and only install them on a certain machine.
I'm guessing updates are easier, and if it breaks something, you can easily rollback to a previous generation. It will not only revert to the exact same packages you used previously, but it will also revert any package configs it controls. And on top of that it lets you pin a package to a specific version, and upgrade everything else.
cross-platform: you can take your list and install the same packages on win/mac natively. They don't need to run linux in a vm like a container would
less storage used?
temporary package installs. For example I only needed
arandr
for 30 seconds to set up a new monitor, so I justnix shell nixpkgs#arandr
and it created a shell with that package. When I was done I just closed the terminal, and didn't need to think about it anymore. The package was completely removed the next time I rannix-collect-garbage
.you need a package that's in no repository, but it has a flake with all of the compilation dependencies? You just
cd
into the repo,nix develop
, and you've got a temporary environment with everything you need to start following the compilation instructionsArch has a lot of packages, but there are some that I had to install through aur which I don't like. Nixpkgs have so far had everything I needed, except for nixgl (although I couldn't get a few of them to work). Also, you can chose between "stable" and unstable repos. Arch doesn't have a frozen version with updates every ~6 weeks, and no other release based distro comes even close in either quantity or freshness.
That's what I can think of for a casual user. There are a lot more benefits for professionals to be honest, and I wouldn't suggest nix at all if home-manager didn't massively simplify the whole process. Getting to those few simple files from above was a massive pain, and it's made even worse by the official nix guide suggesting outdated methods, and most of the support threads being for nixos. With them, you can get going in like 10 minutes even if you don't know anything.
Thanks for your great explanation!
How up-to-date are the packages, compared to Flatpaks?
IIRC, I used Nix a while ago to install a program, which was supposedly hard to build for Linux and crashed all the time as Flatpak. Sadly, the Nix version was almost a year old and also not great.
But I think I'll take a look into it again. I began using terminal apps a lot more and also became a huge fan of image based distros, and I think Nix packages have similar benefits as immutable distros.
Same or more up to date. It's up there with arch, but some packages are purposely separated. For example the
go
package is 1.21.7, but there's also ago_1_22
package that's 1.22.1. I'm guessing they're waiting for it to be fully tested, while arch replaced it immediately.check here , set the channel to unstable to see the freshest packages
Nix as an external pm has most of the benefits, but almost none of the downsides. It creates an immutable package store, but doesn't cause FHS compliance related issues.