summary refs log tree commit diff
path: root/doc/languages-frameworks
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2018-04-21 19:37:49 +0200
committerBas van Dijk <v.dijk.bas@gmail.com>2018-04-22 10:34:44 +0200
commitbf6d796a2763f2f58c8e04f9505478d478de0e97 (patch)
tree1c3c510904f55e276f25b09c9d87711c20a4e39d /doc/languages-frameworks
parent3d1976b083354c4bf0bce1243d73c607784b807a (diff)
downloadnixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.tar
nixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.tar.gz
nixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.tar.bz2
nixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.tar.lz
nixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.tar.xz
nixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.tar.zst
nixlib-bf6d796a2763f2f58c8e04f9505478d478de0e97.zip
haskell: allow overriding all package sets at once
Setting haskell.packageOverrides like so:

  haskell = super.haskell // {
    packageOverrides = self: super: {
      my-package = ...;
      my-other-package = ...;
    };
  };

causes all compiler-specific package sets to be overridden with those
overrides.
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r--doc/languages-frameworks/haskell.section.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md
index 1623e0d276f2..3b8971c295bb 100644
--- a/doc/languages-frameworks/haskell.section.md
+++ b/doc/languages-frameworks/haskell.section.md
@@ -666,6 +666,56 @@ prefer one built with GHC 7.8.x in the first place. However, for users who
 cannot use GHC 7.10.x at all for some reason, the approach of downgrading to an
 older version might be useful.
 
+### How to override packages in all compiler-specific package sets
+
+In the previous section we learned how to override a package in a single
+compiler-specific package set. You may have some overrides defined that you want
+to use across multiple package sets. To accomplish this you could use the
+technique that we learned in the previous section by repeating the overrides for
+all the compiler-specific package sets. For example:
+
+```nix
+{
+  packageOverrides = super: let self = super.pkgs; in
+  {
+    haskell = super.haskell // {
+      packages = super.haskell.packages // {
+        ghc784 = super.haskell.packages.ghc784.override {
+          overrides = self: super: {
+            my-package = ...;
+            my-other-package = ...;
+          };
+        };
+        ghc822 = super.haskell.packages.ghc784.override {
+          overrides = self: super: {
+            my-package = ...;
+            my-other-package = ...;
+          };
+        };
+        ...
+      };
+    };
+  };
+}
+```
+
+However there's a more convenient way to override all compiler-specific package
+sets at once:
+
+```nix
+{
+  packageOverrides = super: let self = super.pkgs; in
+  {
+    haskell = super.haskell // {
+      packageOverrides = self: super: {
+        my-package = ...;
+        my-other-package = ...;
+      };
+    };
+  };
+}
+```
+
 ### How to recover from GHC's infamous non-deterministic library ID bug
 
 GHC and distributed build farms don't get along well: