initial commit

This commit is contained in:
Amy de Buitléir 2023-06-12 16:37:53 +01:00
parent 1935bcebb2
commit fb453b751f
5 changed files with 600 additions and 0 deletions

View file

@ -0,0 +1,40 @@
== 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.
=== A Bash script depending on a package in the nixpkgs repo.
Script:
[source,bash,linenums]
....
include::bash-with-nixpkg.sh[]
....
Output:
....
$# shebangs/bash-with-nixpkg.sh
....
=== A Python script depending on a package in the nixpkgs repo.
Script:
[source,bash,linenums]
....
include::python-with-nixpkg.sh[]
....
Output:
....
$# shebangs/python-with-nixpkg.sh
....