Yes, I’d say this is a fair description. More accurate if you suffix it with “outside of a dev shell”.
And it applies to just about every interpreted language other than those intended as actual shells.
Yes, I’d say this is a fair description. More accurate if you suffix it with “outside of a dev shell”.
And it applies to just about every interpreted language other than those intended as actual shells.
Does packaging a script with a derivation as described in one of your earlier posts also effectively wrap the script in the correct environment, or would I still need nix-shell to do that?
It does wrap it with the correct environment, yes.
When packaging a script in a derivation, should I avoid putting a shebang at the top, or does it really make a difference (presuming the interpreter uses # as a comment character)?
Adding a shebang doesn’t hurt as long as the interpreter uses the # character for comments. Worst case it lets your editor know how to do syntax highlighting.
Whether it’s necessary depends on the builder you use. writePython3 adds the correct interpreter shebang for you, so there’s no real reason to add a shebang. stdenv.mkDerivation does no such thing, so you need to add a shebang (the patchShebangs hook will automatically set up the correct reference if the interpreter is in buildInputs, though, so you don’t need to worry about patching that manually).
Just two minor hints.
The official wiki is at: https://wiki.nixos.org, I don’t know if it makes a difference in your link but it is something to be aware of as the other one gets mainly ignore by the community.
As for googling.
I personally use the GitHub search a lot as it shows you examples outside of Nixpkgs.
And https://noogle.dev/ can be helpful as well.