Making nix on ostree Fedora work?

Nix uses /nix to store packages afaik.

On rpm-ostree Distros, could one do something like ln -s /var/nix /nix on every boot to make this work? Where would that be done, in the fstab, or using a systemd service?

Does nix autostart something that would make this difficult, where the symlink needs to be added before?

I think adding nix to immutable Fedora versions could have some benefits, for example that it doesnt use user namespaces, which are disabled in the hardened kernel. Flatpaks can work here, using bubblewrap-suid but Podman and all the tooling like Toolbox and Distrobox don’t work yet.

Nix also has a ton of packages, more than the AUR I heard, especially more supported ones. You can run entire Desktops from Nix, add unstable packages to stable Variants (if they ever come with rpm-ostree) and more.

Do you know if this is possible? I would anyways like to try it, but already fail with installing it, as it is not an rpm, but built locally afaik. So this would probably need to be done in the image creation process, for example for ublue?

I wouldn’t expect to see it in an atomic desktop any time soon, I think the many drawbacks of nix far outweigh the miniscule benefits especially when distrobox/vms let you do the same; but alas if you’re so inclined Nix on Fedora · GitHub

1 Like

Are you talking of NixOS or Nix the package manager?

The latter, I’d imagine. Silverblue already does what NixOS does for the most part.

Thanks for your opinion but I wasn’t asking you I was asking @boredsquirrel .

yes the nix package manager. It would simply be a nice addition to have it on Atomic, so have more packages and supposedly also without a reboot.

Advantage here could be to leave the core system untouched, for use cases where the system would be completely immutable for verification.

I have run Guix on Silverblue, but I didn’t do much with it there since I was so interested in Guix that I installed GuixSD onto one of my older laptops.

There is this discussion How to install nix cleanly? - #8 by yajo

and this repo where they are attempting to do what you are talking about… fix: make nix work out of the box on rpm-ostree by yajo · Pull Request #8 · nix-community/nix-installers · GitHub

Do you have the installation procedure somewhere? I assume you used something like this Nix installer script that sets up bind mounts for the store, but Guix probably has subtle differences.

Hello @lmhpfr ,
Sorry for that, I checked what I had written down about it to answer, and it was on WS (workstation) and I made a partition mounted at /gnu specifically for it. It was the same time I started using Silverblue on my primary workstation, and I guess that made a connection in my mind, so back around F27. It did spur me on to install GuixSD onto an older laptop, though.
Just while on the topic of Nix, is it more popular because there are more packages available in Nix?

1 Like

No worries. Yes, Nix is more popular for several reasons, one of which is that it’s more popular. There’s a positive feedback loop there.

To get back to the original topic, the Determinate Systems Nix installer has supported ostree-based distributions since Add support for ostree-based Linux distributions by Hofer-Julian · Pull Request #586 · DeterminateSystems/nix-installer · GitHub was merged. So following their instructions on immutable Fedora editions should just work, and if not, you can open an issue there. This approach should be more reliable (and supported) than the scripts you can find floating around in GitHub repos and gists.

Edit: I may have spoken too soon: Not working on Fedora Silverblue (rpm-ostree based) · Issue #783 · DeterminateSystems/nix-installer · GitHub

Hi folks, check out Nix Toolbox which makes it easy to use Nix on Fedora Silverblue or general on Fedora. As easy as use toolbox.

2 Likes

This is nice, but nests nix inside a fedora container. So it is not perfect, home-manager likely doesnt work? And as it uses a container it causes higher RAM usage.

I personally switched to NixOS for now