about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/nim.section.md17
1 files changed, 15 insertions, 2 deletions
diff --git a/doc/languages-frameworks/nim.section.md b/doc/languages-frameworks/nim.section.md
index 45cd07b3a3d8..c6ebf49b83f6 100644
--- a/doc/languages-frameworks/nim.section.md
+++ b/doc/languages-frameworks/nim.section.md
@@ -50,7 +50,20 @@ $ nix build -f . ttop.src
 $ nix run -f . nim_lk ./result | jq --sort-keys > pkgs/by-name/tt/ttop/lock.json
 ```
 
-## Lockfile dependency overrides {#nimoverrides}
+## Overriding Nim packages {#nim-overrides}
+
+The `buildNimPackage` function generates flags and additional build dependencies from the `lockFile` parameter passed to `buildNimPackage`. Using [`overrideAttrs`](#sec-pkg-overrideAttrs) on the final package will apply after this has already been generated, so this can't be used to override the `lockFile` in a package built with `buildNimPackage`. To be able to override parameters before flags and build dependencies are generated from the `lockFile`, use `overrideNimAttrs` instead with the same syntax as `overrideAttrs`:
+
+```nix
+pkgs.nitter.overrideNimAttrs {
+  # using a different source which has different dependencies from the standard package
+  src = pkgs.fetchFromGithub { /* … */ };
+  # new lock file generated from the source
+  lockFile = ./custom-lock.json;
+}
+```
+
+## Lockfile dependency overrides {#nim-lock-overrides}
 
 The `buildNimPackage` function matches the libraries specified by `lockFile` to attrset of override functions that are then applied to the package derivation.
 The default overrides are maintained as the top-level `nimOverrides` attrset at `pkgs/top-level/nim-overrides.nix`.
@@ -81,7 +94,7 @@ The annotations in the `nim-overrides.nix` set are functions that take three arg
 - finalAttrs: the final attrset passed by `buildNimPackage` to `stdenv.mkDerivation`.
 - prevAttrs: the attrset produced by initial arguments to `buildNimPackage` and any preceding lockfile overlays.
 
-### Overriding an Nim library override {#nimoverrides-overrides}
+### Overriding an Nim library override {#nim-lock-overrides-overrides}
 
 The `nimOverrides` attrset makes it possible to modify overrides in a few different ways.