Merge pull request #210762 from sternenseemann/nix-ghc-docdir

ghc.withPackages: install documentation to -with-packages output
This commit is contained in:
maralorn 2023-01-15 19:38:56 +01:00 committed by GitHub
commit 0d88794d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 2 deletions

View File

@ -371,6 +371,17 @@
<literal>nixos/modules/profiles/minimal.nix</literal> profile.
</para>
</listitem>
<listitem>
<para>
The <literal>ghcWithPackages</literal> and
<literal>ghcWithHoogle</literal> wrappers will now also
symlink GHCs and all included libraries documentation to
<literal>$out/share/doc</literal> for convenience. If
undesired, the old behavior can be restored by overriding the
builders with
<literal>{ installDocumentation = false; }</literal>.
</para>
</listitem>
<listitem>
<para>
<literal>mastodon</literal> now supports connection to a

View File

@ -100,6 +100,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`.

View File

@ -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