Cargo-script scripts in nix derivations?

I like the idea of https://rust-script.org/ and cargo-script, but main problem with it I see is that when running such scripts in nix derivation, they will want to do rust compilation and will fail due to the sanbox.

I’m wondering what’s the best approach to making them usable. RN. the best idea I can see is to have something like patchShebangs, that would just pre-compile everything, kind of like what crane does. Does it make sense, is doable?