I'm a big fan of Nix Flakes but they appear to have the same issue here as "curl | bash".
I mention this because Flakes can do much of what Docker can do, but do not use containers or virtualization.
The official NixPkgs are carefully vetted. Nix Flakes make it more convenient to pull in sources from outside NixPkgs.
As Nix Flakes become more prevalent, perhaps there needs to be some way to containerize them. There are more benefits to Nix Flakes than native execution so containerizing them somehow might be an acceptable compromise.