lib.fixedPoints.toExtension: improve documentation

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
Yueh-Shun Li
2024-09-03 19:04:14 +08:00
parent 2937899bef
commit 53a24f4a7c

View File

@@ -444,21 +444,20 @@ rec {
`toExtension` is the `toFunction` for extending functions (a.k.a. extensions or overlays). `toExtension` is the `toFunction` for extending functions (a.k.a. extensions or overlays).
It converts a non-function or a single-argument function to an extending function, It converts a non-function or a single-argument function to an extending function,
while returning a double-argument function as-is. while returning a two-argument function as-is.
That is, it takes one of `x`, `prev: x`, or `final: prev: x`, That is, it takes a value of the shape `x`, `prev: x`, or `final: prev: x`,
and returns `final: prev: x`, where `x` is not a function. and returns `final: prev: x`, assuming `x` is not a function.
This function is extracted from the implementation of This function takes care of the input to `stdenv.mkDerivation`'s
the fixed-point arguments support of `stdenv.mkDerivation`. `overrideAttrs` function.
It bridges the gap between `<pkg>.overrideAttrs` It bridges the gap between `<pkg>.overrideAttrs`
before and after the overlay-style support, before and after the overlay-style support.
as well as `config.packageOverrides` and `config.overlays` in `pkgs`.
# Inputs # Inputs
`f` `f`
: The function or non-function to convert to an extending function. : The function or value to convert to an extending function.
# Type # Type
@@ -509,6 +508,6 @@ rec {
# f is (prev: { ... }) # f is (prev: { ... })
fPrev fPrev
else else
# f is { ... } # f is not a function; probably { ... }
final: prev: f; final: prev: f;
} }