1
0
mirror of https://github.com/bennofs/nix-script synced 2025-01-09 20:34:20 +01:00

Update readme

This commit is contained in:
rnhmjoj 2015-09-21 05:32:01 +02:00
parent 5af095e97c
commit 9814f6462e

View File

@ -27,6 +27,7 @@ To use `nix-script`, you need to add a header to your file. Here is an example f
```haskell
#!/usr/bin/env nix-script
#!> haskell
#! env | EDITOR
#! haskell | text lens optparse-applicative
#! shell | nix nix-prefetch-scripts
@ -40,6 +41,8 @@ The first line just tells the shell to use `nix-script` when executing the scrip
The next lines the specify dependencies of the script. The first entry on each line is the language of the following dependencies. This is required so that language-specific names can be converted to the correct nix attribute names. You should have one line per language. In our case, we say that we want to use the `text`, `lens` and `optparse-applicative` haskell packages. We also want that `nix` and `nix-prefetch-scripts` are available in $PATH (the `shell` language doesn't apply any renaming to their dependencies and just passes them through unmodified).
The lines starting with `env` specify additional environment variables to be kept in the environment where the script will run. In this case the variable`EDITOR` editor.
We can now mark the script executable and run it:
```