summary refs log tree commit diff
path: root/doc/builders/packages
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-04-12 16:31:01 +0200
committerGitHub <noreply@github.com>2021-04-12 16:31:01 +0200
commite355946df1ba59072329653507113b7d9ed5dedd (patch)
treeb3789385e4bda38ff15d353fe48769ac5f32e433 /doc/builders/packages
parentb50d86446a40c3645cb3c64123b198cf576ca8ba (diff)
parentcdfbdb0b2c0eab92079d1e477a93781d7b9e2cc2 (diff)
downloadnixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.tar
nixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.tar.gz
nixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.tar.bz2
nixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.tar.lz
nixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.tar.xz
nixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.tar.zst
nixpkgs-e355946df1ba59072329653507113b7d9ed5dedd.zip
Merge pull request #103546 from mnacamura/cdda-small-fix
Diffstat (limited to 'doc/builders/packages')
-rw-r--r--doc/builders/packages/cataclysm-dda.section.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/builders/packages/cataclysm-dda.section.md b/doc/builders/packages/cataclysm-dda.section.md
index 1173fe32ada..0f908cb7590 100644
--- a/doc/builders/packages/cataclysm-dda.section.md
+++ b/doc/builders/packages/cataclysm-dda.section.md
@@ -34,6 +34,41 @@ cataclysm-dda.override {
 }
 ```
 
+## Important note for overriding packages
+
+After applying `overrideAttrs`, you need to fix `passthru.pkgs` and
+`passthru.withMods` attributes either manually or by using `attachPkgs`:
+
+```nix
+let
+  # You enabled parallel building.
+  myCDDA = cataclysm-dda-git.overrideAttrs (_: {
+    enableParallelBuilding = true;
+  });
+
+  # Unfortunately, this refers to the package before overriding and
+  # parallel building is still disabled.
+  badExample = myCDDA.withMods (_: []);
+
+  inherit (cataclysmDDA) attachPkgs pkgs wrapCDDA;
+
+  # You can fix it by hand
+  goodExample1 = myCDDA.overrideAttrs (old: {
+    passthru = old.passthru // {
+      pkgs = pkgs.override { build = goodExample1; };
+      withMods = wrapCDDA goodExample1;
+    };
+  });
+
+  # or by using a helper function `attachPkgs`.
+  goodExample2 = attachPkgs pkgs myCDDA;
+in
+
+# badExample                     # parallel building disabled
+# goodExample1.withMods (_: [])  # parallel building enabled
+goodExample2.withMods (_: [])    # parallel building enabled
+```
+
 ## Customizing with mods
 
 To install Cataclysm DDA with mods of your choice, you can use `withMods`