Yesterday with @infinisil on #nixos, he pointed me to: peti/jailbreak-cabal#7 after a good deal of time wrangling through a package to make it work.
The `nix-build -K` command, is very handy for debugging things like these, again I learnt from infinisil.
And after much experimenting and looking through, it turned out that jailbreaking wasn't working as expected, and its documentation could point it out to avoid future confusion.
Haskell packages overridden with justStaticExecutables
(like cabal-install, stack, pandoc, darcs, etc.) don't provide
libraries in the end result so it's futile to build them with library
profiling enabled because it will just take extra time.
This adds a `readDirectory` utility that can be used to "slurp" a directory
full of `cabal2nix`-generated files and transform them into a Haskell package
override set. The main use of this is so that users don't have to write:
```
{ overrides = self: super: {
foo = self.callPackage ./path/to/foo.nix { };
bar = self.callPackage ./path/to/bar.nix { };
...
};
}
```
Instead, they can write:
```
{ overrides = pkgs.haskell.lib.readDirectory ./path/to;
}
```
This is a an alternative to `packageSourceOverrides` which primarily addresses
the following use cases:
* The desired package is not yet available in `all-cabal-hashes` (perhaps the
user is pinned to an older revision of `nixpkgs`)
* The default `cabal2nix` invocation used by `packageSourceOverrides`
does not use the desired `cabal2nix` flags
* The user wants to avoid the use of import-from-derivation
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.