diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
index 242841a56b65..378480129961 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml
@@ -344,6 +344,17 @@
nixos/modules/profiles/minimal.nix profile.
+
+
+ The ghcWithPackages and
+ ghcWithHoogle wrappers will now also
+ symlink GHC’s and all included libraries’ documentation to
+ $out/share/doc for convenience. If
+ undesired, the old behavior can be restored by overriding the
+ builders with
+ { installDocumentation = false; }.
+
+
mastodon now supports connection to a
diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md
index b5c74836ef40..6e0a0acbf543 100644
--- a/nixos/doc/manual/release-notes/rl-2305.section.md
+++ b/nixos/doc/manual/release-notes/rl-2305.section.md
@@ -94,6 +94,11 @@ In addition to numerous new and upgraded packages, this release has the followin
- The minimal ISO image now uses the `nixos/modules/profiles/minimal.nix` profile.
+- The `ghcWithPackages` and `ghcWithHoogle` wrappers will now also symlink GHC's
+ and all included libraries' documentation to `$out/share/doc` for convenience.
+ If undesired, the old behavior can be restored by overriding the builders with
+ `{ installDocumentation = false; }`.
+
- `mastodon` now supports connection to a remote `PostgreSQL` database.
- `services.peertube` now requires you to specify the secret file `secrets.secretsFile`. It can be generated by running `openssl rand -hex 32`.
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index c478c875540d..acb9156b0a7e 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -4,6 +4,8 @@
# platform that has NCG support
, useLLVM ? false
, withHoogle ? false
+# Whether to install `doc` outputs for GHC and all included libraries.
+, installDocumentation ? true
, hoogleWithPackages
, postBuild ? ""
, ghcLibdir ? null # only used by ghcjs, when resolving plugins
@@ -54,7 +56,11 @@ let
else "$out/lib/${ghc.targetPrefix}${ghc.haskellCompilerName}";
docDir = "$out/share/doc/ghc/html";
packageCfgDir = "${libDir}/package.conf.d";
- paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
+ paths = lib.concatLists (
+ builtins.map
+ (pkg: [ pkg ] ++ lib.optionals installDocumentation [ (lib.getOutput "doc" pkg) ])
+ (lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages))
+ );
hasLibraries = lib.any (x: x.isHaskellLibrary) paths;
# CLang is needed on Darwin for -fllvm to work:
# https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
@@ -71,7 +77,9 @@ symlinkJoin {
# if such a feature is needed, the real compiler name should be saved
# as a dedicated drv attribute, like `compiler-name`
name = ghc.name + "-with-packages";
- paths = paths ++ [ghc];
+ paths = paths
+ ++ [ ghc ]
+ ++ lib.optionals installDocumentation [ ghc.doc ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
# wrap compiler executables with correct env variables