Use autoPatchelf inside mkShell

I don’t have an exact answer, but both of these are hooks. I’d wager that the functions explicitly don’t have each other in scope; you could probably source the script directly instead though. I’d love some detailed docs on the hook mechanism in general, the nixpkgs manual doesn’t explain much, and the setup.sh script is as easy to understand as you’d expect a bash script with hidden dependency scripts to be…

Anyway, I’m commenting because this topic basically does what you want, and comments go over alternatives: https://discourse.nixos.org/t/how-to-use-python-on-nixos-without-nix/