Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Fwiw, all of those except rolldice are in Nixpkgs, and you can also use Nix on top of any Linux distribution, separate from the base system, just like you use brew separate from the base system on macOS. Nix on top of Ubuntu, for example, would support all those packages. You won't like the CLI though

PS: Debian has > 3x as many packages as Arch[1]. It would surprise me very much if that was just a matter of things being more split up in Debian, or Debian's higher count of virtual packages. When people talk about Arch's great selection of packages, they're including the AUR, which is actually massive. Imo it makes more sense, then, to include the AUR in little tests like this.

1: https://repology.org/repositories/statistics/total



sort by: page size:

Thanks! So let's say I start installing Nix packages. What distro's packages would they end up most similar to? Say, maybe Arch (which mostly leaves things unmodified)? Does that mean you basically end up with Arch no matter which distro you're on?

If you don't mind the storage penalty, it looks pretty convenient to set up an Arch Linux chroot and use packages from the AUR when you need to: https://github.com/lemniskett/archbox/blob/master/NIXOS_INST...

Nixpkgs itself is several times the size of the base Arch Linux package collection, and by ‘non-unique’ package count, Nixpkgs is also much larger than the AUR. In addition to Nixpkgs, you can find Nix packages in several community ‘overlays’ for Nixpkgs as well as Nix's own user repositories.

You can check to see whether everything you currently use/need is conveniently available for NixOS in a comprehensive-ish way through the combination of these two web search tools:

• for Nixpkgs/NixOS: https://search.nixos.org/packages?channel=21.05

• for NUR: https://nur.nix-community.org/

NixOS also includes native Flatpak support.

Fwiw, packaging most things for Nix is very easy. I left Arch in ~2010 because at the time the package management stack and default repos on Arch basically sucked compared to most distros I'd used and liked, and from then on I decided that if I wanted software that wasn't in my distro's repos I'd just package it myself. After taking a little time to learn the tools on whatever distro I was using, I never missed Arch or the AUR. Compared to other distros, packaging normal software from source is usually exceptionally easy on NixOS.

If I were you I'd just dive right in and hit Nix's channel on Matrix with the Nixpkgs manual in hand if I found something I wanted to use that wasn't already packaged. But you can fall back on the options outlined above.


I use the nix package manager on Arch btw

Other package collections are available for Linux e.g. pkgsrc, Nix, the Linux port of Homebrew, ...

No, because that would be comparing the number of official packages + third party packages with duplicates in Arch against the number of official packages in Nixpkgs. That's as fair as comparing the number of official Nixpkgs packages + every unofficial Nix package on GitHub against the number of official Arch packages.

Now make that API agnostic so I can use package from any distribution (deb,rpm,pkg,static build) and I am in!

FYI we also know guix...

My main problem is that you repackage every lib and build it on your own, sometimes some patching is necessary to make it nix aware.


This is misleading. Because nixpkgs repackages all of npm, pip, hackage etc. packages. Stuff that on other distros are managed by their respective tools seperate from the distro packaging. Still nixpkgs is pretty vast.

Thank you for the awesome reply (and everyone else). This is precisely the issue I have though:

> The downside is that a significant amount of the time, libraries written in scripting languages aren't packaged either, and you wind up packaging half a dozen libraries just to get some tool working.

I've gone down this path a few times and days later when I still don't have the original thing I wanted working installed, then I sort of give up. I realize there are many benefits to Nix and I really enjoy them but I've switched to using Arch for practical reasons. I really, really miss the declarative reproducible style though.


I have had a great experience using the Nix package manager on other Linux distros. It's super easy to try out software with `nix-shell -p somepackage`. (It's a little rockier on macOS.)

Another neat trick is reproducible shell scripts that use Nix to declare their dependencies in a sort of extended shebang line.


Have you tried using something like `home-manager` (https://github.com/rycee/home-manager)? It gives you declarative package and configuration management with Nix on non-NixOS. It might be a nice compromise until NixOS/Nixpkgs is mature enough to meet your needs more completely. Or maybe you'll never switch, if you really like the convenience of being able to easily grab a trendy package from AUR or whatever. But either way, there's a lot of declarative Nix-y goodness you can get on Arch Linux! :-D

There's a similar tool for macOS called `nix-darwin`, as well: https://github.com/LnL7/nix-darwin


Sure, with enough work, you can probably make Debian work with pacman, and Archlinux with apt-get. The problem with those package managers is that they install everything on /. If you try to use both package managers at once, they'll most likely conflict with one another.

Nix on the other hand will install each package under it's own version- or build-specific directory under /nix. ~/.nix-profile will be a symlink pointing to your profile under /nix, and ~/.nix-profile/bin will contain the executables of what you installed with nix.

This isn't just a question of putting files under something other than /. pacman (and maybe apt, too) has a way of installing packages under different directories, but the files in the packages themselves will typically have references to the libraries, executables and other files they depend on assuming they've been installed under /. So, in order to use those installed packages, you'd have to chroot into the directory you've selected to act as root, so the references will work right. Nix, on the other hand, made sure to edit the references each package has to their dependencies so you can simply execute something in ~/.nix-profile/bin and each successive dependency will resolve its dependencies to build-specific directories under /nix.

You can use nix with pacman or apt-get or yum or any traditional package manager you'd like and they won't conflict. This is what is meant by being distribution agnostic.


Except not everything in nixpkgs is a package! It's closer to a standard library that just happens to include a lot of packages.

Thanks, but that makes me wonder how that's even possible given that distros make their own modifications? Do people port each distro's packages to Nix then? Are they kept up-to-date? Or does it automatically translate from apt/pacman/etc. databases somehow? Or does it just basically install vanilla packages on all distro?

There's also nix-darwin and home-manager. I barely use brew anymore, not directly anyway, for the rare packages that aren't in nixpkgs.

Even so, I did a quick search on repology and Nix derivations with multiple outputs (the nix lingo analogous to the subpackages you mentioned) are counted as a single package. For example, bash has 5 outputs but only counts for 1 package in the 85k figure, so I think comparing 900 packages to 85k is a valid comparison.

Anyway, this is all besides the point I was trying to make which is that I don't see why I should use _yet another_ software distribution that has 1% of the amount of packages found in a mature distribution that already has frequent automatic updates and bleeding-edge software revisions.


You do not have to abandon distribution model. I've just installed Nix on Arch Linux [1]. It ships all required dependencies - glibc etc - version specific. Works on Ubuntu/Debian [2].

[1] https://wiki.archlinux.org/index.php/Nix

[2] https://ariya.io/2020/05/nix-package-manager-on-ubuntu-or-de...


Any reproducible package manager is suffice. Debian aims for that, too, AFAIK.

With Homebrew you end up having to link the binary, and you cannot link different binaries with the same name.

I just use venvs for Python, and pipx takes care of that, together with topgrade which ensures all software repos remain updated, Homebrew or Nix or not. For Rust I use Cargo, etc etc.

I'd agree Nix does it more elegantly but it is a very different beast to handle. Anything I want to do with Nix(OS) I have to look up how they do it.


Nixpkgs is a whole collection of software (a distribution of sorts, but not a Linux distro), managed by Nix, which works identically on all Linux distros. It's also the package collection for NixOS.

Nix is cross-distro in the ordinary sense you describe, of course. It is also more deeply cross-distro in that: • if you are trying to package for Nix in a normal way (the tools make it easy to do things this way and hard to do things otherwise by their nature), _all_ package collections for Nix will be cross-distro in this way • The Nix community has a collection of thousands of cross-distro packages you can already use right now

`pkgsrc` is similar in this respect, and takes a more conventional approach, like the one you describe in this comment. I think that's a meaningful sense in which it is cross-distro.

Another way to think of this is that tools like `rpm` and `dpkg` or `dnf` and `apt` are portable between distros _as far as distro developers are concerned_, whereas package managers/package collections like Nixpkgs and pkgsrc meet the portability needs of users of _existing distros_.


So basically, one could make this compatible with current Arch packages by making packages install into /nix/store/<id> instead?
next

Legal | privacy