Install nix without root on darwin?

GitLab now provides shared macos runners; Amazon has also started offering EC2 macos instances.

Both suggestions in the Installation Guide (Nix Installation Guide - NixOS Wiki) don’t support darwin (nix-user-chroot, PRoot).

This answer claims:

Be aware though that, for both, changing the store path means changing the hash of a lot of derivatives. This means that you mostly cannot use pre-built binary packages any more and will end up building (almost) everything from source.

Which would be impractical.

Is there a way to easily install as root; or, easily meet the larger goal of building under GitLab or EC2? Either a direct route (nix-build directly) or indirect route (via remote build). Or would this wind up being a time sink?

Not sure I follow; the title says you need to install without root, but the final paragraph asks for a way to install as root?

Have you already tried and failed? Is sudo not available?

Should have said non-root.

There’s no indication root is available and it’s currently in beta so I’m a bit reluctant to try.

I don’t know what gitlab is doing, but the docs for EC2 suggest sudo should be available.

In either case, macOS 10.15+ will require sudo, so there are probably two answers:

  • if they let you use 10.14, you may be able to get through a single-user install without sudo
  • otherwise, only if sudo is available or if you can move the store without causing insurmountable problems (I get the impression that this is ill-advised at best, but I haven’t tried)