about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authormaralorn <mail@maralorn.de>2023-01-15 19:38:56 +0100
committerGitHub <noreply@github.com>2023-01-15 19:38:56 +0100
commit0d88794d585b8d269b6de9448226a437eadf7003 (patch)
tree8f7f67aa6e46707080aa7e685645f5d97c3009e1 /pkgs/development/haskell-modules
parentbfa0c4e83c1083192c6f150a67fae22077f6b498 (diff)
parent727491cd957632ae9dc0449f3600999b40a8a61a (diff)
downloadnixlib-0d88794d585b8d269b6de9448226a437eadf7003.tar
nixlib-0d88794d585b8d269b6de9448226a437eadf7003.tar.gz
nixlib-0d88794d585b8d269b6de9448226a437eadf7003.tar.bz2
nixlib-0d88794d585b8d269b6de9448226a437eadf7003.tar.lz
nixlib-0d88794d585b8d269b6de9448226a437eadf7003.tar.xz
nixlib-0d88794d585b8d269b6de9448226a437eadf7003.tar.zst
nixlib-0d88794d585b8d269b6de9448226a437eadf7003.zip
Merge pull request #210762 from sternenseemann/nix-ghc-docdir
ghc.withPackages: install documentation to -with-packages output
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index 94cee5c0c6d7..eaf9a6b3b16a 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