Code change:
Project description
I marked this as stale due to inactivity. &rarr;
ping! Is this still an issue?
has been The command still does not have documentation in the Nixpkgs manual.
Is satisfying? Could use approval to get merged.
It's a good step, but it doesn't (yet?) tell me what the options are.
Now it does.

Related discussion:
text: ### `patch-shebangs.sh` {#patch-shebangs.sh} <del> This setup hook patches installed scripts to use the full path to the shebang interpreter. A shebang interpreter is the first commented line of a script telling the operating system which program will run the script (e.g `#!/bin/bash`). In Nix, we want an exact path to that interpreter to be used. This often replaces `/bin/sh` with a path in the Nix store. </del> <ins> This setup hook patches installed scripts to add Nix store paths to their shebang interpreter as found in the build environment. The [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line tells a Unix-like operating system which interpreter to use to execute the script's contents. ::: note The [generic builder][generic-builder] populates `PATH` from inputs of the derivation. ::: [generic-builder]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/stdenv/generic/builder.sh #### Invocation {#patch-shebangs.sh-invocation} Multiple paths can be specified. ``` patchShebangs [--build | --host] PATH... ``` ##### Flags `--build` : Look up commands available at build time `--host` : Look up commands available at run time ##### Examples ```sh patchShebangs --host /nix/store/<hash>-hello-1.0/bin ``` ```sh patchShebangs --build configure ``` `#!/bin/sh` will be rewritten to `#!/nix/store/<hash>-some-bash/bin/sh`. `#!/usr/bin/env` gets special treatment: `#!/usr/bin/env python` is rewritten to `/nix/store/<hash>/bin/python`. Interpreter paths that point to a valid Nix store location are not changed. ::: note A script file must be marked as executable, otherwise it will not be considered. ::: This mechanism ensures that the interpreter for a given script is always found and is exactly the one specified by the build. It can be disabled by setting [`dontPatchShebangs`](#var-stdenv-dontPatchShebangs): ```nix stdenv.mkDerivation { # ... dontPatchShebangs = true; # ... } ``` The file [`patch-shebangs.sh`][patch-shebangs.sh] defines the [`patchShebangs`][patchShebangs] function. It is used to implement [`patchShebangsAuto`][patchShebangsAuto], the [setup hook](#ssec-setup-hooks) that is registered to run during the [fixup phase](#ssec-fixup-phase) by default. If you need to run `patchShebangs` at build time, it must be called explicitly within [one of the build phases](#sec-stdenv-phases). [patch-shebangs.sh]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh [patchShebangs]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh#L24-L105 [patchShebangsAuto]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/pkgs/build-support/setup-hooks/patch-shebangs.sh#L107-L119 </ins> ### `audit-tmpdir.sh` {#audit-tmpdir.sh}