Commit Graph

63 Commits

Author SHA1 Message Date
sternenseemann
456faf71e5 ghcWithPackages: use haskellCompilerName for ghclibdir
This is done for consistency with generic-builder.nix and because it's
easier for downstream users to replicate which will inevitably use our
code as inspiration.
2022-03-31 12:50:43 +02:00
sternenseemann
383fbfadcc ghcWithPackages: use packageCfgDir over ghc.name where appropriate
This is an incorrectness pointed out in #153319 which we already have
a proper solution for.
2022-03-31 12:37:00 +02:00
sternenseemann
8c27f7a2bd haskellPackages.ghcWithPackages: throw on old override interface
Adding a fake override function via passthru will at least give users of
the old override interface a more helpful error message. Additionally we
also document the changes in the changelog.
2022-02-08 13:28:30 +01:00
sternenseemann
fb075fab73 haskellPackages.{ghcWithPackages, ghcWithHoogle}: make overrideable
This is achieved by passing the entire package set to the respective
wrappers and passing the select function as a second attribute. Together
with the new support for callPackage-ing functions this allows for
things like `ghcWithPackages.override { useLLVM = true; } (p: [ … ])`.

To make this possible for `ghcWithHoogle` as well, we need to make the
wrapper a bit more bespoke and inline the hoogle feature as well. The
hoogle wrapper, however, can remain separate and is exposed as
`hoogleWithPackages` additionally, as it can also serve standalone use.
`hoogleLocal` is kept for backwards compatibility (including the old,
suboptimal API), but will inform users about the better alternative via
a warning.
2022-01-06 12:21:45 +01:00
sternenseemann
f662c8be61 ghcWithPackages: remove check for GHC >= 6.12
It's been quite a while since any version below that has been in use in
nixpkgs, so this check is almost certainly safe to remove.
2022-01-06 12:21:45 +01:00
sternenseemann
50f256f5ef ghcWithPackages: don't wrap GHC with LLVM unnecessarily
Since GHC now will have LLVM available when needed, we don't need to add
it in the wrapper anymore. It can still be added if NCG is available,
but -fllvm should be used (e. g. to work around an NCG bug).
2021-11-25 19:28:57 +01:00
sternenseemann
c32095b400 ghcWithPackages: rename withLLVM to useLLVM
useLLVM is what we are using in the GHC derivations already -- for
better or for worse -- so we should rename the argument here for
consistency which we are free to do as this is purely internal at the
moment (with overriding being impossible).
2021-11-24 10:21:39 +01:00
sternenseemann
2f98c1824c ghcWithPackages: GHC 8.10.7 still needs LLVM for aarch64-darwin
This check was wrong and caused by a bit of confusion on my part.
GHC >= 8.10.5 && < 9 supports aarch64-darwin via LLVM and GHC >= 9.2.1
introduces the NCG backend for aarch64-darwin.
2021-11-23 16:01:45 +01:00
sternenseemann
571f3e504b ghcWithPackages: list missing targets with NCG available
Based on https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms, although
it sadly doesn't list when the backends were introduced.

* PowerPC, x86 (and x86_64) and Sparc have been supported for longer.

* aarch64-darwin is new in 9.2.1 and backported to 8.10.5, 8.10.6 and
  8.10.7 (check is dumb here since we'll grep for 8.10.7 anyways when
  upgrading)

Fixes ghcWithPackages failing to evaluate on aarch64-darwin because of
missing support for the platform in LLVM 9's compiler-rt.
2021-11-18 16:33:51 +01:00
sternenseemann
cfdc073da4 ghcWithPackages: check targetPlatform to decide if NCG is available
The availability of native codegen (which allows us to disable the LLVM
backend by default) hinges on the target platform of the compiler (that
is GHC), not on the platform it runs on (the host platform).
2021-11-18 16:33:51 +01:00
sternenseemann
9a2e728831 ghcWithPackages: set withLLVM if hostPlatform is not x86_64
We also don't add LLVM on PowerPC as GHC should have the ability to
generate native code for that platform itself.

Resolves #116235.
2021-05-03 10:42:52 +02:00
John Ericson
07ecf87693 treewide: Fix various tools wrappers "with packages"
Now that `buildEnv` is ready, always put `makeWrapper` in
`nativeBuildInputs`, rather than `buildInputs` or (worse) mucking around
with setup hooks by hand.

(C.f. #112276, which didn't catch these because the manual setup hook
sourcing is such a hack to being with!)

Fixes #114687
2021-03-02 22:38:04 +00:00
Malte Brandy
ae73fa0d56 haskellPackages.ghc.withPackages: Remove obsolete ghcide wrapper 2020-09-18 21:50:29 +02:00
Malte Brandy
af017c431a
haskellPackages.haskell-language-server: 0.2.0 -> 0.3.0
While we are at it I:
* Disable tests, because I can‘t keep up with the speed hls introduces
more tests that cause trouble in nixpkgs.
* Fix builds of fourmolu and retrie
* Remove the wrapper for hls which is obsolete because of improved
package detection in hie-bios. And added a note that this can be removed
for ghcide soon, too.
2020-08-16 13:57:18 +02:00
Malte Brandy
ac8c823955 ghc.withPackages: Wrap hls with package lookup env 2020-07-24 13:02:55 +02:00
Malte Brandy
4e67e3da06 ghc.withPackages: Add wrapper for ghcide 2020-06-05 21:58:25 +02:00
Soares Chen
32d2de8e00 haskell: Fix with-packages-wrapper MacOS linker hack for GHC 8.8
`with-packages-wrapper.nix` has a hack to workaround the linker limit
in MacOS Sierra. However that is now broken with GHC 8.8, because of
slight change in the format of the package config.
In short, the package config produced by GHC 8.8 has a new line between
the key and list of values, while earlier versions have them separated
by a single space.

This PR fixes the linker hack by modifying the `grep` and `sed` commands
to pattern match on either space or new line, so that the hack can work
on all versions of GHC.
2020-05-29 22:28:47 +02:00
Guillaume Bouchard
abc4f961b4 haskellPackages.ghcWithPackages: fix for GHC 8.10
This closes #79441.

ghcWithPackages is using `ghc-pkg recache` to build its package
database. By doing so, it overrides the `package.cache[.lock]` files.

Details are unclear, but GHC 8.10 changed a bit the behavior.
Previously, it was unconditionally replacing the files by new ones. Now
it tries to open (for modification) the files. These files are symlinks
to another nix derivation, which is hence read-only.

This commit removes the files before running `ghc-pkg recache`, hence it
will just write the new files.

Tested with `haskellPackages.ghcWithPackages` (i.e. GHC 8.8) and
`haskell.packages.ghc8101.ghcWithPackages` (i.e GHC 8.10) with the
following nix file, at the root of the nixpkgs repository:

```
with import ./. {
  overlays = [
    (
      self: super: {
        haskellPackages = super.haskell.packages.ghc8101.override {
          overrides = selfh: superh: {
             th-lift-instances = super.haskell.lib.doJailbreak superh.th-lift-instances;
             th-expand-syns    = super.haskell.lib.doJailbreak superh.th-expand-syns;
             th-reify-many     = super.haskell.lib.doJailbreak superh.th-reify-many;
             th-orphans        = super.haskell.lib.doJailbreak superh.th-orphans;
             haskell-src-meta  = super.haskell.lib.doJailbreak superh.haskell-src-meta;
          };
        };
      }
  )
  ];
};
haskellPackages.ghcWithPackages(p:[p.PyF])
```

This will test with GHC 8.10. Comment out the `overlays` to test with
GHC 8.8.
2020-04-17 20:50:48 +02:00
Peter Simons
4a2aad0d39
Revert "haskell/with-packages-wrapper.nix: install "doc" outputs" 2020-01-10 15:20:08 +01:00
Matthew Bauer
93aabab760 haskell/with-packages-wrapper.nix: remove /bin symlink if it exists
The wrapper need a writable directory to work, so remove the symlink
to a read-only one if it occurs.
2020-01-06 18:25:50 -05:00
Matthew Bauer
e915608618 haskell/with-packages-wrapper.nix: install "doc" outputs
We were previously just installing the "out" output which broke when
we recently changed to generating multiple outputs.

Fixes #76837
2020-01-02 16:12:46 -05:00
John Ericson
0828e2d8c3 treewide: Remove usage of remaining redundant platform compatability stuff
Want to get this out of here for 18.09, so it can be deprecated
thereafter.
2018-08-30 17:20:32 -04:00
Matthew Bauer
e01db49bfa ghcjs-ng: Move to $out/lib/ghcjs-8.4
This is standard for ghc compilers & much more convenient. This seems
to fix the issues we have been having in ghcjs pkgs.

Fixes #42032
Fixes #42617
2018-06-26 17:43:58 -04:00
Matthew Bauer
34f57ac837 haskell: fix with-packages-wrapper in ghcjs
Fixes #42032
Fixes #42070
2018-06-18 20:17:06 -04:00
Sarah Brofeldt
2956cc8760 haskellPackages.ghcWithPackages: Wrap haddock with GHC lib dir 2018-03-15 20:16:54 +01:00
Peter Simons
13dda44b8b haskell-with-packages-wrapper: don't bother with extraOutputsToInstall
symlinkJoin doesn't recognize this parameter, so this functionality has been
broken ever since 4b77d425aa.
2018-02-09 20:26:35 +01:00
Peter Simons
e30ecaa916
Merge pull request #33636 from hamishmack/haskell-internal-libs-darwin2
haskell: Fix depending on libs with internal libs on darwin.
2018-01-12 16:09:56 +01:00
Hamish Mackenzie
d3eaa5a4de haskell: Fix depending on libs with internal libs on darwin. 2018-01-09 14:43:13 +13:00
John Ericson
ec2f121bed ghcWithPackages: Fix comment URL 2018-01-04 14:49:52 -05:00
John Ericson
dea9fceb0b ghcWithPackages: Get rid of unused passthrough
If you want the whole packages set...don't use ghcWithPackages.
2018-01-04 14:49:50 -05:00
John Ericson
6bdf9a7f6d ghcWithPackages: Don't bother with ignoreCollisions cause we don't use buildEnv
SymlinkJoin doesn't know or care about this.
2018-01-04 11:45:36 -05:00
John Ericson
5e31e828f8 ghcWithPackages: Fix cross, and avoid needless C compiler 2018-01-03 01:24:57 -05:00
John Ericson
a224dfc253 haskell infra: Fix cross as much as possible without changing hashes 2018-01-02 21:00:13 -05:00
Peter Simons
8d8061ec20
Revert "Revive multiple outputs for Haskell packages." 2017-12-05 09:36:08 +01:00
Nicholas Clarke
dc0e594451 Fix 'ghcWithPackages' as per https://github.com/NixOS/nixpkgs/issues/32082 2017-11-27 16:09:03 +00:00
Jude Taylor
737b466031 fix ghcjs socket.io 2017-11-01 12:16:48 +01:00
davidak
3270aa896b replace "Mac OS X" and "OS X" with "macOS"
as it is the official name since 2016

https://en.wikipedia.org/wiki/Macintosh_operating_systems#Desktop

exception are parts refering to older versions of macOS like

"GUI support for Mac OS X 10.6 - 10.12. Note that Emacs 23 and later [...]"
2017-08-07 21:41:30 +02:00
Judah Jacobson
2caa7b88ae Fix use of isDarwin conditionals. 2017-05-05 09:53:08 -07:00
Judah Jacobson
7131e06214 haskell: work around linker limits on Mac OS X Sierra.
The Sierra linker added a limit on the number of paths that any one
dynamic library (`*.dylib`) can reference.  This causes problems when
a Haskell library has many immediate dependencies (#22810).

We follow a similar fix as GHC/Cabal/Stack: for each derivation,
create a new directory with symlinks to all the dylibs of its immediate
dependencies, and patch its package DB to reference that directory
using the new `dynamic-library-dirs` field.

Note that this change is a no-op for older versions of GHC, i.e., they will
continue to fail on some packages as before.

Also note that this change causes the bootstrapped versions of GHC to be
recompiled, since they depend on `hscolour` which is built by
`generic-builder.nix`.

Tested by building the `stack` binary as described in #22810.
2017-05-05 09:26:58 -07:00
David Johnson
26623240e9 Init HaLVM at 2.4.0 2017-03-10 19:31:12 -06:00
3noch
4b77d425aa
Fix GHCJS HEAD patch; support GHCJS libdir link; use full ghcEnv for GHCJS
Original:
f3110651c8

(With some tweaks from @cstrahan)

closes #23199
2017-03-02 11:35:11 -05:00
Peter Simons
656707ef80 Merge pull request #21916 from Profpatsch/ghcWithPackages-docs
haskell: add doc outputs to with-packages-wrapper.nix
2017-01-16 10:58:06 +01:00
Profpatsch
546d0c0460 haskell: add doc outputs to with-packages-wrapper.nix
We want to have all doc outputs as well (also e.g. ghc documentation).
Adds a bit of documentation to the postInstall script.
2017-01-16 00:13:13 +01:00
Shea Levy
a798850675 ghc with-packages-wrapper: Add support for cross-compiling 2017-01-13 21:21:21 -05:00
Profpatsch
499e4e6393 ghc.withPackages: amend the derviation name
Provide a clear difference between the compiler itself and link farms containing
additional packages.
2016-11-17 16:48:53 +01:00
Nikolay Amiantov
8b7ebaffeb replace makeSearchPath tree-wise to take care of possible multiple outputs 2016-04-13 22:09:41 +03:00
Charles Strahan
3859f7bdab haskell-ng: hoogleLocal support 2015-06-11 20:25:31 -04:00
Charles Strahan
929dc4199a ghcjs: properly wrap binaries in environment
This also:

 1  Builds Setup.hs with ghcjs, which (among other things) defines
    __GHCJS__ and ghcjs_HOST_OS during pre-processing.
 2  Fixes ghc-paths to point at ghcjs and use NIX_GHCJS_* env-vars.
 3  Boots ghcjs into $prefix/lib/$compiler.
2015-05-08 11:33:44 -04:00
Peter Simons
c449a930aa ghcWithPackages: add postBuild hook so that users can mess with the generated environment
postBuild can be used to execute user-specific commands on the generated $out
environment before finalizing the build. For example, this hook can be used to
generate appropriate 'makeWrapper' script for binaries contained in the
environment.
2015-04-28 13:17:44 +02:00
Charles Strahan
3d60f6401f haskell: fix GHC version check for GHCJS
closes #7137
2015-04-03 18:54:18 -04:00