doc: document buildPython* stdenv overriding via <function>.override

This commit is contained in:
Yueh-Shun Li
2025-01-23 05:06:44 +08:00
parent 7cf8ffb32a
commit 3a4c37457b
3 changed files with 20 additions and 0 deletions

View File

@@ -557,6 +557,19 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function).
with the `pipInstallHook`.
- `unittestCheckHook` will run tests with `python -m unittest discover`. See [example usage](#using-unittestcheckhook).
#### Overriding build helpers {#overriding-python-build-helpers}
Like many of the build helpers provided by Nixpkgs, Python build helpers typically provide a `<function>.override` attribute.
It works like [`<pkg>.override`](#sec-pkg-override), and can be used to override the dependencies of each build helper.
This allows specifying the stdenv to be used by `buildPythonPackage` or `buildPythonApplication`. The default (`python.stdenv`) can be overridden as follows:
```nix
buildPythonPackage.override { stdenv = customStdenv; } {
# package attrs...
}
```
## User Guide {#user-guide}
### Using Python {#using-python}