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`. with the `pipInstallHook`.
- `unittestCheckHook` will run tests with `python -m unittest discover`. See [example usage](#using-unittestcheckhook). - `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} ## User Guide {#user-guide}
### Using Python {#using-python} ### Using Python {#using-python}

View File

@@ -3807,6 +3807,9 @@
"buildpythonpackage-parameters": [ "buildpythonpackage-parameters": [
"index.html#buildpythonpackage-parameters" "index.html#buildpythonpackage-parameters"
], ],
"overriding-python-build-helpers": [
"index.html#overriding-python-build-helpers"
],
"overriding-python-packages": [ "overriding-python-packages": [
"index.html#overriding-python-packages" "index.html#overriding-python-packages"
], ],

View File

@@ -314,6 +314,10 @@
- `emacs` now disables the GC mark trace buffer by default. This improves GC performance by 5%, but can make GC issues harder to debug. This is configurable with `withGcMarkTrace`. - `emacs` now disables the GC mark trace buffer by default. This improves GC performance by 5%, but can make GC issues harder to debug. This is configurable with `withGcMarkTrace`.
- Passing `stdenv` to `buildPythonPackage` or `buildPythonApplication` has been deprecated and will trigger an error in a future release.
Instead, you should _override_ the python build helper, e.g., `(buildPythonPackage.override { stdenv = customStdenv; })`.
See [](#overriding-python-build-helpers).
- `buildPythonPackage` and `buildPythonApplication` now default to `nix-update-script` as their default `updateScript`. This should improve automated updates, since nix-update is better maintained than the in-tree update script and has more robust fetcher support. - `buildPythonPackage` and `buildPythonApplication` now default to `nix-update-script` as their default `updateScript`. This should improve automated updates, since nix-update is better maintained than the in-tree update script and has more robust fetcher support.
- `plasma6`: Fixed the `ksycoca` cache not being re-built when `$XDG_CACHE_HOME` is set to something that isn't `$HOME/.cache`. - `plasma6`: Fixed the `ksycoca` cache not being re-built when `$XDG_CACHE_HOME` is set to something that isn't `$HOME/.cache`.