writeShellApplication: buildInputs -> runtimeInputs

This commit is contained in:
Bernardo Meurer 2021-10-12 12:48:27 -07:00
parent 89979c9c5b
commit 0e4f04b74c
No known key found for this signature in database
GPG key ID: F4C0D53B8D14C246
2 changed files with 5 additions and 5 deletions

View file

@ -49,7 +49,7 @@ Many more commands wrap `writeTextFile` including `writeText`, `writeTextDir`, `
## `writeShellApplication` {#trivial-builder-writeShellApplication}
This can be used to easily produce a shell script that has some dependencies (`buildInputs`). It automatically sets the `PATH` of the script to contain all of the listed inputs, sets some sanity shellopts (`errexit`, `nounset`, `pipefail`), and checks the resulting script with [`shellcheck`](https://github.com/koalaman/shellcheck).
This can be used to easily produce a shell script that has some dependencies (`runtimeInputs`). It automatically sets the `PATH` of the script to contain all of the listed inputs, sets some sanity shellopts (`errexit`, `nounset`, `pipefail`), and checks the resulting script with [`shellcheck`](https://github.com/koalaman/shellcheck).
For example, look at the following code:
@ -57,7 +57,7 @@ For example, look at the following code:
writeShellApplication {
name = "show-nixos-org";
buildInputs = [ curl w3m ];
runtimeInputs = [ curl w3m ];
text = ''
curl -s 'https://nixos.org' | w3m -dump -T text/html

View file

@ -260,7 +260,7 @@ rec {
* # Writes my-file to /nix/store/<store path>/bin/my-file and makes executable.
* writeShellApplication {
* name = "my-file";
* buildInputs = [ curl w3m ];
* runtimeInputs = [ curl w3m ];
* text = ''
* curl -s 'https://nixos.org' | w3m -dump -T text/html
* '';
@ -269,7 +269,7 @@ rec {
writeShellApplication =
{ name
, text
, buildInputs ? [ ]
, runtimeInputs ? [ ]
, checkPhase ? null
}:
writeTextFile {
@ -282,7 +282,7 @@ rec {
set -o nounset
set- o pipefail
export PATH="${makeBinPath buildInputs}:$PATH"
export PATH="${makeBinPath runtimeInputs}:$PATH"
${text}
'';