about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-08-20 00:02:22 +0000
committerGitHub <noreply@github.com>2022-08-20 00:02:22 +0000
commit318717f2e38f5d5ff795e303d4a231f93999adaa (patch)
tree19591fbdc57eab4912752e1123bc10380aec2ceb /doc
parent949c5dc1a1d4ab3c46d3f96599f5ae5a7cf8ea03 (diff)
parent287e8bfb2dc42c15836c458b5a7adc1eef17181a (diff)
downloadnixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.tar
nixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.tar.gz
nixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.tar.bz2
nixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.tar.lz
nixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.tar.xz
nixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.tar.zst
nixlib-318717f2e38f5d5ff795e303d4a231f93999adaa.zip
Merge master into staging-next
Diffstat (limited to 'doc')
-rw-r--r--doc/stdenv/stdenv.chapter.md19
1 files changed, 17 insertions, 2 deletions
diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md
index b4cc50b509d4..fa61973263ae 100644
--- a/doc/stdenv/stdenv.chapter.md
+++ b/doc/stdenv/stdenv.chapter.md
@@ -871,12 +871,27 @@ Constructs a wrapper for a program with various possible arguments. It is define
 # adds `FOOBAR=baz` to `$out/bin/foo`’s environment
 makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
 
-# prefixes the binary paths of `hello` and `git`
+# Prefixes the binary paths of `hello` and `git`
+# and suffixes the binary path of `xdg-utils`.
 # Be advised that paths often should be patched in directly
 # (via string replacements or in `configurePhase`).
-makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]}
+makeWrapper $out/bin/foo $wrapperfile \
+  --prefix PATH : ${lib.makeBinPath [ hello git ]} \
+  --suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
 ```
 
+Packages may expect or require other utilities to be available at runtime.
+`makeWrapper` can be used to add packages to a `PATH` environment variable local to a wrapper.
+
+Use `--prefix` to explicitly set dependencies in `PATH`.
+
+:::{note}
+`--prefix` essentially hard-codes dependencies into the wrapper.
+They cannot be overridden without rebuilding the package.
+:::
+
+If dependencies should be resolved at runtime, use `--suffix` to append fallback values to `PATH`.
+
 There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh` for the `makeWrapper` implementation and in `nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh` for the `makeBinaryWrapper` implementation.
 
 `wrapProgram` is a convenience function you probably want to use most of the time, implemented by both `makeWrapper` and `makeBinaryWrapper`.