mirror of
https://github.com/bennofs/nix-script
synced 2025-01-10 12:54:20 +01:00
Update readme
This commit is contained in:
parent
5af095e97c
commit
9814f6462e
@ -27,6 +27,7 @@ To use `nix-script`, you need to add a header to your file. Here is an example f
|
|||||||
```haskell
|
```haskell
|
||||||
#!/usr/bin/env nix-script
|
#!/usr/bin/env nix-script
|
||||||
#!> haskell
|
#!> haskell
|
||||||
|
#! env | EDITOR
|
||||||
#! haskell | text lens optparse-applicative
|
#! haskell | text lens optparse-applicative
|
||||||
#! shell | nix nix-prefetch-scripts
|
#! 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 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:
|
We can now mark the script executable and run it:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user