writeShellApplication: buildInputs -> runtimeInputs

main
Bernardo Meurer 3 years ago
parent 89979c9c5b
commit 0e4f04b74c
No known key found for this signature in database
GPG Key ID: F4C0D53B8D14C246
  1. 4
      doc/builders/trivial-builders.chapter.md
  2. 6
      pkgs/build-support/trivial-builders.nix

@ -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

@ -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}
'';

Loading…
Cancel
Save