Skip to content

NPV 146

Michael Daniels edited this page Mar 28, 2026 · 1 revision

NPV-146: Nix file has a shebang but is not executable

Description

Nix files (.nix) in Nixpkgs that start with a shebang (#!) line must have the executable permission bit set. These files are expected to be scripts.

Error message

{relative_path}: Nix files with a shebang (`#!`) line must be executable.

Example

If pkgs/by-name/fo/foo/package.nix begins with #! but does not have its executable bit set:

pkgs/by-name/fo/foo/package.nix: Nix files with a shebang (`#!`) line must be executable.

How to fix

If the file is intended to be a standalone script, add the executable bit to the file:

chmod +x pkgs/by-name/fo/foo/package.nix

Or, if the file is intended to be a standalone script, remove the shebang line, e.g.:

- #!/usr/bin/env nix-shell

Clone this wiki locally