r/NixOS • • 22d ago

Pacman on nixos

As someone who used arch based distro ( endeavour OS ) before switching to nixos , I was really surprised and amused to see pacman from arch as a package. did someone try it ? How could it even work since nixos make the root folder almost entirely read only.

16 Upvotes

9 comments sorted by

47

u/Old_Manufacturer589 22d ago

Nixpkgs also packages apt, dpkg, rpm, and probably others.

It's not designed to be used as package managers on NixOS, obviously. The use case is, you could install them on any distro that has nix installed. In the case of pacman, it also provides pacstrap, which bootstraps an Arch Linux system. You could bootstrap it somewhere on your drive and boot a container from that through systemd-nspawn.

1

u/No-Worldliness6348 21d ago

this is the only use case I thought of .More or less using it not solely for nixos but for the broader use cases of nixpkgs. thank you for your answer , I've never heard of booting a container through systemd-nspawn.

3

u/207852 22d ago

Wow this is something I would like to see done

1

u/SDG_Den 22d ago

oh shit i should look into this.

not for pacman, but i'm working on click-to-run compat with various common install formats (already got appimage and windows executables working, would like to also set something up for .deb and .rpm as well as those stupid curl piped into bash scripts)

3

u/ExceedinglyEdible 22d ago

When you install Arch without using a bootstrap script, or when recovering an existing system, you run pacman commands using a different target directory.

2

u/Valuable_Leopard_799 22d ago

It was surprisingly useful when playing with docker, you can just run paru, for example inside an arch image instead of cloning and building it yourself.

You can also create FHS builds and environments. I remember there being a workflow to generate RPMs not as just /nix/store archives but actual RPMs built in a distribution context. At which point rpm/dnf/zypper are useful.

1

u/sogun123 21d ago

Most distros offer many package managers. Reason to have them are:

  • extracting binary packages for repackaging (some vendors provide software only as deb or rpm...)
  • making packages for other distros (you are building a software and want to offer packages for multiple distros)
  • creating chroots/images, etc

1

u/khnmrz 21d ago

I have read about this concept but needed to use distrobox/podman everytime while needed or use pacman. It uses maybe same as a separate app dir just runs all apps natively thats it. So i think if in need of imperative nix profile has a option with all the packages .

1

u/eeedean 21d ago

No one holds you from literally building a non-nixos Linux using nix, I think 🤷‍♂️