From cda3c8a1d54ba8fe821a261acb4ae8976a8c3ad6 Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Sun, 10 Nov 2024 09:19:49 +0100 Subject: [PATCH] doc/stdenv: add a note about `strictDeps` --- doc/redirects.json | 3 +++ doc/stdenv/stdenv.chapter.md | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/doc/redirects.json b/doc/redirects.json index ffa10799fa6f..879145eed084 100644 --- a/doc/redirects.json +++ b/doc/redirects.json @@ -788,6 +788,9 @@ "var-stdenv-depsTargetTargetPropagated": [ "index.html#var-stdenv-depsTargetTargetPropagated" ], + "var-stdenv-strictDeps": [ + "index.html#var-stdenv-strictDeps" + ], "ssec-stdenv-attributes": [ "index.html#ssec-stdenv-attributes" ], diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md index 6013436f2b8a..e4bc4ec516af 100644 --- a/doc/stdenv/stdenv.chapter.md +++ b/doc/stdenv/stdenv.chapter.md @@ -487,6 +487,14 @@ The propagated equivalent of `buildInputs`. This would be called `depsHostTarget The propagated equivalent of `depsTargetTarget`. This is prefixed for the same reason of alerting potential users. +##### `strictDeps` {#var-stdenv-strictDeps} + +When using native compilation, `stdenv` is lenient towards incorrect placement of a dependency into one of the dependency lists described above. That means a dependency needed at runtime often works, even if it is only present in `nativeBuildInputs`. Vice-versa, dependencies containing binaries that need to be executed during the build will work even if they are only listed in `buildInputs`. + +While convenient for getting to a package quickly, this behavior can break cross-compilation. Adding `strictDeps = true` as a parameter to `mkDerivation` or any of its language specific wrappers disables this behavior. + +The specialized `build*` functions for dlang, emacs, go, nim, ocaml, python, and rust enable this option by default. + ## Attributes {#ssec-stdenv-attributes} ### Variables affecting `stdenv` initialisation {#variables-affecting-stdenv-initialisation}