diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-06-05 21:22:45 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2021-06-07 06:34:59 +0200 |
commit | 6ecc641d087df8b8896ebd876bba592e981877c9 (patch) | |
tree | c3dc98e6b6a4a6474b21ad06e7bbc96d0e8abaf5 /doc/using | |
parent | ce6b1a4f8f9cbbb7fd2d1c637bcc39fff1ef49df (diff) | |
download | nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.tar nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.tar.gz nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.tar.bz2 nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.tar.lz nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.tar.xz nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.tar.zst nixpkgs-6ecc641d087df8b8896ebd876bba592e981877c9.zip |
doc: prepare for commonmark
We are still using Pandoc’s Markdown parser, which differs from CommonMark spec slightly. Notably: - Line breaks in lists behave differently. - Admonitions do not support the simpler syntax https://github.com/jgm/commonmark-hs/issues/75 - The auto_identifiers uses a different algorithm – I made the previous ones explicit. - Languages (classes) of code blocks cannot contain whitespace so we have to use “pycon” alias instead of Python “console” as GitHub’s linguist While at it, I also fixed the following issues: - ShellSesssion was used - Removed some pointless docbook tags.
Diffstat (limited to 'doc/using')
-rw-r--r-- | doc/using/overlays.chapter.md | 2 | ||||
-rw-r--r-- | doc/using/overrides.chapter.md | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/doc/using/overlays.chapter.md b/doc/using/overlays.chapter.md index 21efe467b84..537d031bcdb 100644 --- a/doc/using/overlays.chapter.md +++ b/doc/using/overlays.chapter.md @@ -63,7 +63,7 @@ The second argument (`super`) corresponds to the result of the evaluation of the The value returned by this function should be a set similar to `pkgs/top-level/all-packages.nix`, containing overridden and/or new packages. -Overlays are similar to other methods for customizing Nixpkgs, in particular the `packageOverrides` attribute described in <xref linkend="sec-modify-via-packageOverrides"/>. Indeed, `packageOverrides` acts as an overlay with only the `super` argument. It is therefore appropriate for basic use, but overlays are more powerful and easier to distribute. +Overlays are similar to other methods for customizing Nixpkgs, in particular the `packageOverrides` attribute described in<xref linkend="sec-modify-via-packageOverrides"/>. Indeed, `packageOverrides` acts as an overlay with only the `super` argument. It is therefore appropriate for basic use, but overlays are more powerful and easier to distribute. ## Using overlays to configure alternatives {#sec-overlays-alternatives} diff --git a/doc/using/overrides.chapter.md b/doc/using/overrides.chapter.md index c1ab710e061..66e5103531a 100644 --- a/doc/using/overrides.chapter.md +++ b/doc/using/overrides.chapter.md @@ -48,17 +48,17 @@ In the above example, the `separateDebugInfo` attribute is overridden to be true The argument `oldAttrs` is conventionally used to refer to the attr set originally passed to `stdenv.mkDerivation`. -::: note -Note that `separateDebugInfo` is processed only by the `stdenv.mkDerivation` function, not the generated, raw Nix derivation. Thus, using `overrideDerivation` will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that `overrideAttrs` should be preferred in (almost) all cases to `overrideDerivation`, i.e. to allow using `stdenv.mkDerivation` to process input arguments, as well as the fact that it is easier to use (you can use the same attribute names you see in your Nix code, instead of the ones generated (e.g. `buildInputs` vs `nativeBuildInputs`), and it involves less typing). +::: {.note} +Note that `separateDebugInfo` is processed only by the `stdenv.mkDerivation` function, not the generated, raw Nix derivation. Thus, using `overrideDerivation` will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that `overrideAttrs` should be preferred in (almost) all cases to `overrideDerivation`, i.e. to allow using `stdenv.mkDerivation` to process input arguments, as well as the fact that it is easier to use (you can use the same attribute names you see in your Nix code, instead of the ones generated (e.g. `buildInputs` vs `nativeBuildInputs`), and it involves less typing). ::: ## <pkg>.overrideDerivation {#sec-pkg-overrideDerivation} -::: warning +::: {.warning} You should prefer `overrideAttrs` in almost all cases, see its documentation for the reasons why. `overrideDerivation` is not deprecated and will continue to work, but is less nice to use and does not have as many abilities as `overrideAttrs`. ::: -::: warning +::: {.warning} Do not use this function in Nixpkgs as it evaluates a Derivation before modifying it, which breaks package abstraction and removes error-checking of function arguments. In addition, this evaluation-per-function application incurs a performance penalty, which can become a problem if many overrides are used. It is only intended for ad-hoc customisation, such as in `~/.config/nixpkgs/config.nix`. ::: @@ -81,8 +81,8 @@ In the above example, the `name`, `src`, and `patches` of the derivation will be The argument `oldAttrs` is used to refer to the attribute set of the original derivation. -::: note -A package's attributes are evaluated *before* being modified by the `overrideDerivation` function. For example, the `name` attribute reference in `url = "mirror://gnu/hello/${name}.tar.gz";` is filled-in *before* the `overrideDerivation` function modifies the attribute set. This means that overriding the `name` attribute, in this example, *will not* change the value of the `url` attribute. Instead, we need to override both the `name` *and* `url` attributes. +::: {.note} +A package's attributes are evaluated *before* being modified by the `overrideDerivation` function. For example, the `name` attribute reference in `url = "mirror://gnu/hello/${name}.tar.gz";` is filled-in *before* the `overrideDerivation` function modifies the attribute set. This means that overriding the `name` attribute, in this example, *will not* change the value of the `url` attribute. Instead, we need to override both the `name` *and* `url` attributes. ::: ## lib.makeOverridable {#sec-lib-makeOverridable} |