But for MacOS how would that work without first having to do first install nix to /nix. Are there pre-built static/portable binaries for MacOS at all?
Wouldn’t it be extra interesting to do this for MacOS because the regular way to install Nix on MacOS is so cumbersome and error prone (creating a new encrypted volume, etc)?
What a store URL (given to the Nix command flag --store or the Nix config option store) specify is not an alternative store directory (builtins.storeDir or /nix/store), but more like an alternative chroot root where /nix/store resides.
Ah okay, thanks, but I guess there is a way of actually setting an alternative store path in Nix, right? In my question just substitute that for the wrong command I gave.
PS: MacOS actually does seem to support chroot as well, why isn’t that used for Nix on Mac rather than the awkward volume creation/mounting procedure for /nix ?
I think --store would be what you’re looking for instead of builtins.storeDir changing. (The latter causes world rebuild and was only relevant before we have the former.)
I’m not familiar with Mac, but have heard that Nix people experienced quite a few trouble before fixing the Nix installation and multi-user mode support on MacOS.
No, I was actually looking for a truly different store path. I want to world rebuild (i.e. compile from source instead of downloading packages from the Nix cloud cache). But before even getting to try that, I’m failing to even run Nix on MacOS without first setting up the /nix volume stuff bc as far as I know the prebuilt MacOS binaries assume to be installed in /nix
That same post also mentions that it’s become impossible to use chroot when System Integrity Protection is enabled. Disabling SIP is a no-go at least for work provided Macs.
In the context of this thread, the project fakedir was made for might be of particular interest:
Running the nix script at the root of your repository will automatically determine if you have Nix installed or not. If Nix is installed, it will just redirect the call to your system-wide Nix. It’s when it is not installed that the magic happens.
Nixie will automatically download a prebuilt static nix binary from this repository’s CI jobs into your user’s cache directory