How to run `nix-shell` on derivation function?

I understand that I can run nix-shell if I replace a derivation’s function arguments with with import <nixpkgs> {};, but is there a way to avoid this step?

nix-shell -E 'with import <nixpkgs>{}; callPackage ./path/to/file.nix {}'

which is essentially what you suggest, but done “externally”

Oh perfect, just like nix-build!