Nixos-container with different nix version

I am trying to work around an issue with the latest nixUnstable and hercules-ci. Essentially, since the recent update to the nixUnstable package, they don’t seem to know how to speak to each other anymore.

I was going to try and work around this by simply running hercules-ci in a container with stable nix, however, setting nix.package = lib.mkForce pkgs.nixStable in the container doesn’t seem to have the desired effect, as nix is still using the daemon from the host system.

I’m just curious if anyone has successfully used a different version of the nix-daemon inside a container, or if it would even be possible.

I don’t think it’s possible to do so out of the box with NixOS containers (because indeed they reuse the host’s nix-daemon). However if it’s OK to use a totally different store for the CI agent, you might be lucky using NIX_REMOTE=/some/directory (which will bypass the daemon and put the nix store under /some/directory with some namespaces magic to pretend that it’s still under /nix).