Skip to content

Commit

Permalink
doc/build-helpers/fixed-point-arguments.chapter.md: fixup
Browse files Browse the repository at this point in the history
Co-authored-by: Philip Taron <[email protected]>
  • Loading branch information
ShamrockLee and philiptaron authored Dec 7, 2024
1 parent 3faa87e commit b6d3e4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/build-helpers/fixed-point-arguments.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ Many existing build helpers only pass part of their arguments down to their base

As a wrapper around [`overrideAttrs`](#sec-pkg-overrideAttrs), `lib.extendMkDerivation` passes the whole set of arguments directly to the base build helper before extending them, making it incompatible with build helpers that only pass part of their input arguments down the base build helper.

To workaround this issue, [`lib.customisation.adaptMkDerivation`](#function-library-lib.customisation.adaptMkDerivation) is introduced. Instead of taking an attribute overlay that returns a subset of attributes to update, it takes an argument set adapter that returns the whole set of arguments to pass to the base build helper, allowing the removal of some arguments. The expression change needed to adopt `lib.adaptMkDerivation` is also smaller, enabling a smooth transition toward fixed-point arguments.
To work around this issue, [`lib.customisation.adaptMkDerivation`](#function-library-lib.customisation.adaptMkDerivation) is introduced. Instead of taking an attribute overlay that returns a subset of attributes to update, it takes an argument set adapter that returns the whole set of arguments to pass to the base build helper, allowing the removal of some arguments. The change needed to adopt `lib.adaptMkDerivation` is also smaller, enabling a smooth transition to fixed-point arguments.

:::{.example #ex-build-helpers-mkLocalDerivation-adaptMkDerivation}

# Example definition of `mkLocalDerivation` extended from `stdenv.mkDerivation` with `lib.adaptMkDerivation`

Should the original definition of build helper `mkLocalDerivation` take an argument `specialArg` that cannot be passed to `sdenv.mkDerivation`,
Let's take as our example a build helper `mkLocalDerivation`, which requires an argument `specialArg` that cannot be passed to `stdenv.mkDerivation`.

```nix
{
Expand All @@ -92,7 +92,7 @@ stdenv.mkDerivation (
)
```

wrap around the original definition with `lib.adaptMkDerivation` to make the result build helper accept fixed-point arguments.
`lib.adaptMkDerivation` is able to wrap the original definition to make the resulting build helper accept fixed-point arguments.

```nix
lib.adaptMkDerivation { } stdenv.mkDerivation (
Expand Down

0 comments on commit b6d3e4a

Please sign in to comment.