This is an old post, and I’ve since left the company where I was working on this, but my recollection is that I solved this by by simply requiring all our devs to use a multi-user Nix install (which is to say, I told them precisely what command to run to install Nix). My build scripts then could just source a single bash file as “setup” that sourced the multi-user Nix profile, and then following that they ran other scripts that used #!/usr/bin/env nix-shell
shebangs.
I did consider detecting whether we wanted single-user or multi-user, I did come up with a reasonable approach a while ago, but ultimately we wanted everyone to have the same Nix setup for ease of debugging anyway.