Okay so I have found myself in an interesting situation

I want to have my Router/Server/Whatever you want to call it, uWebServer is how I refer to it, build and serve builds for the rest of my machines. It’s reliably on, water cooled, under my stairs, and most importantly, not a laptop. And to be clear, by builds, I mean my NixOS flake outputs - all of the binaries needed for any of my computers to run.

The problem is two fold:

  1. The main disk, in this case a pair of 256GB SSD’s in RAID0, doesn’t have enough space to fit the binary cache of all my machines
  2. I want to put the cache on a different disk - And also build them on that machine.

So in essence, I have need to somehow convince Nix and possibly some other software to see /nix/store as being located elsewhere, without them knowing.

I’ve considered using chroot but that has downsides, like subtly breaking some of the Behaviour nix uses during builds - Notably visible if you chroot into a mounted system and use nixos-rebuild switch - It’ll error out unless you disable sandboxing.

What I think I’d like to do is see if there is anything along the lines of bwrap (maybe even bwrap!) that can do what I need, which is redirect R/W to my new root for a second copy of Nix.

My current plan of action is to see if I can find a turnkey solution for this, but failing that, I’ll probably end up having to figure out all of this on my own; and I might end up writing my own binary caching software (like in C#).

If you happen across this, feel free to reach out on my Mastodon if you happen to know how to achieve this.