mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2025-12-27 00:34:58 +08:00
14 lines
579 B
Text
14 lines
579 B
Text
= 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 don’t 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]
|