nix-book/source/shebangs/main.adoc
2023-06-13 20:33:24 +01:00

14 lines
579 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

= Nix-shell shebangs
You can use `nix-shell` to run scripts in arbitrary languages, providing
the necessary dependencies. This is particularly convenient for
standalone scripts because you dont need to create a repo and write a
separate `flake.nix`.
The script should start with two "`shebang`" (`#!`) commands. The first
should invoke `nix-shell`. The second should declares the scrpt
interpreter and any dependencies. Here are some examples.
include::bash-with-nix-pkg/main-generated.adoc[leveloffset=+1]
include::python-with-nix-pkg/main-generated.adoc[leveloffset=+1]