This reverts commit d545ef3fa11198f12e525b641aeb33887694f97f. Please don't
commit substantial changes to the generic Haskell builder without giving me a
chance to review them.
This works by extracting out some logic from generic-builder.nix to
make it possible to get at the relevant information by overriding
mkDerivation for the haskell package.
This reverts commit dfb0f254844150d05d34150a975e6479b883d409, reversing
changes made to 7f8ff024372f985e96b438fa5591d9b43fc6e7bd. These changes broke
the ghcWithPackages wrapper:
nix-shell -p "haskellPackages.ghcWithPackages (ps: [ps.mtl])" --run "ghc-pkg list mtl"
/nix/store/szz84j5k1dy3jdashis6ws28d8l8zxxb-ghc-8.0.2-with-packages/lib/ghc-8.0.2/package.conf.d
(no packages)
- The haskell lib is very close to not relying on Nixpkgs. I think
this is good---simpler to think about and matches Nixpkgs's lib.
- The haskell lib is only imported once
- stdenv is exposed more shallowly so it can be overriden more easily.
I'll eventually use this on Darwin to avoid the Sierra shared
library problems (unless changes are to be made system-wide).
Closes https://github.com/NixOS/nixpkgs/pull/27840.
A function is added to enable the generation of a HPC report. For example:
pkgs.haskell.lib.doCoverage drv
will create a HPC report of the Haskell package drv in the directory:
$out/share/hpc
Closes https://github.com/NixOS/nixpkgs/pull/22797/files.
As per the recommendation by @Mathnerd314, this change seems to work
with the testing I did.
It makes sense to me why it works, but I think it's in an important
enough place that someone with much deeper knowledge of Haskell
infrastructure in Nixpkgs should give it a really heavy review.
I also consolidated all the overrideCabal definitions (there were two)
into a single definition in haskell-modules/lib.nix.
-split-sections replaced -split-objs with following upsides:
1) -split-objs adds considerable overhead to compile time
2) combined with stripping, it causes issues when cross-compiling
For upstream see https://ghc.haskell.org/trac/ghc/ticket/8405
This is supported only for Linux/Windows using ld linker.
GHC master also turns on -split-sections by default.
Example using stack:
Without splitting
$ du /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2
4 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share/bash-completion/completions
4 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share/bash-completion
4 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/share
23416 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2/bin
23420 /nix/store/5paayhibayr73zqfaj458g4k4mv108jn-stack-1.3.2
With -split-objs
$ du /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2
20632 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/bin
4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share/bash-completion/completions
4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share/bash-completion
4 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2/share
20636 /nix/store/fypymm529adpx71gdzm0851xz42wdbz0-stack-1.3.2
With -split-sections
$ du /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2
4 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share/bash-completion/completions
4 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share/bash-completion
4 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/share
20672 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2/bin
20676 /nix/store/40l6krinx1zx41lr87c4m12hxj4ldf3x-stack-1.3.2
Note: you currently need following overrides to build stack on 802:
vector-algorithms = dontCheck super.vector-algorithms;
path-io = doJailbreak super.path-io;
stack = doJailbreak super.stack;
Note: Should also work on GHC 8.0.1, but I'm being careful here.
We could backport later on.
Before:
```
error: getting status of
‘/home/user/nixpkgs/pkgs/development/development/haskell-modules/generic-stack-builder.nix’:
No such file or directory
```
In Hydra CI environments, the version strings we get from Hydra don't
necessarily match those hard-coded into the Cabal files. To make those builds
succeed anyway, we have to apply some pattern matching.
* Build most of the stuff on /tmp, not in /nix/store.
* Generate hoogle database for all the dependencies.
* Generate haddock index and contents files.
* Cleanup.
- sdistTarball transforms a normal Haskell build into one that produces a
release tarball by running "sdist". For example:
$ nix-shell -p "haskell.lib.sdistTarball haskellPackages.mtl" --command 'tar tfv $nativeBuildInputs/*tar.gz'
- buildFromSdist transforms a normal Haskell build into one that compiles the
package the an sdist release tarball created by Nix. For example:
$ nix-shell -p "haskell.lib.buildFromSdist haskellPackages.mtl" --command "exit 0"
- buildStrictly transforms a normal Haskell build into one that (a) compiles
the source code with "-Wall -Werror" flags and (b) uses as input a locally
generated sdist release tarball. For example:
$ nix-shell -p "haskell.lib.buildStrictly haskellPackages.mtl" --command "exit 0"
This function is particularly useful for continuous Hydra builds of Haskell
packages.
This makes the attribute (a) consistent with "doCheck" and friends and (b)
avoids the double negation "noHaddock = false" meaning "doHaddock = true".
Fixes https://github.com/NixOS/cabal2nix/issues/63.