Commit graph

18 commits

Author SHA1 Message Date
Peter Simons 981c287355 ghc: several enhancements to the new "with-packages" wrapper
1) The wrapper erroneously used the ghc-pkg flag "--package-db" instead of
    "--global-package-db". The result was that packages installed locally in
    ~/.ghc and ~/.cabal were invisible to GHC. This has been fixed.

 2) The wrapper now deals gracefully with an empty package set: if no package
    is requested to be included in the wrapped environment, the wrapper just
    installs a pristine GHC.

 3) Correctly configure the "docdir" path returned by ghc-paths.

 4) Added some comments that describe the idea behind our ghc-paths patches and
    gives users same sample shell code that can be used to import our special
    environment variables into the currently running shell, so that programs
    outside of the wrapped environment can use them, too.
2013-11-09 20:36:25 +01:00
Peter Simons f92a5cbfc6 pkgs/development/compilers/ghc/with-packages.nix: add 'ignoreCollisions' parameter
The ghcWithPackage expression now has an argument 'ignoreCollisions' that
allows users to disable the path collision check like so:

  (pkgs.haskellPackages.ghcWithPackages (pkgs: with pkgs; [ haskellPlatform ])).override { ignoreCollisions = true; };

See d64917ad17
for a long and detailed discussion of why these path collisions may occur.
2013-11-07 12:14:19 +01:00
Peter Simons 89c566fcfd pkgs/development/compilers/ghc/with-packages.nix: improve recognition of Haskell packages
Haskell packages -- i.e. packages built by our Cabal builder -- invariably have
the attributes 'pname' and 'version'. We use the absence of these attributes to
recognize non-Haskell packages and filter them from the closed package set
generated by closePropagation. We do this so that the generated Haskell
environment won't contain paths like "/lib/libz.a", which are part of the
closure but have nothing to do with Haskell.

The previous scheme used the attribute 'ghc' to accomplish the same thing, but
unfortunately other packages to contain a 'ghc' attribute, too, like the
old-style ghc-wrapper. Including the ghc-wrapper in this environment is
pointless, obviously. The new approach filters the ghc-wrapper successfully.
2013-11-07 12:14:19 +01:00
Peter Simons 094edba311 ghc-with-packages.nix: make sure that GHC itself is included in the environment 2013-10-28 17:54:28 +01:00
Peter Simons d64917ad17 Back-port Haskell-related improvements from stdenv-updates.
* There now is full support for building Haskell packages as shared libraries
   for GHC versions 7.4.2 or later. The Cabal builder recognizes the following
   attributes:

    - enableSharedLibraries configures Cabal to build of shared libraries in
      addition to static ones. This option requires that all dependencies of
      the package have been compiled for use in shared libraries, too.

    - enableSharedExecutables configures Cabal to prefer shared libraries when
      linking executables.

   The default values for these attributes are arguments to the haskellPackages
   expression.

 * Haskell builds now run in a LANG="en_US.UTF-8" environment to avoid plenty
   of build and test suite errors. Without this setting, GHC seems unable to
   deal with the UTF-8 character encoding that's generally considered standard
   in the Haskell world.

 * The Cabal builder supports a new attribute 'testTarget' to specify the exact
   set of tests to be run during the check phase.

 * The ghc-wrapper attribute ghcVersion has been removed. Instead, we use the
   ghc.version attribute, which exists in unwrapped GHC derivations, too.
2013-10-27 10:09:36 +01:00
Gergely Risko de35a6dbb9 Export ghci config files for ghc-vis and ghc-heap-view 2013-08-11 23:50:04 +02:00
Peter Simons 893c684e99 pkgs/development/compilers/ghc/with-packages.nix: include share/emacs/site-lisp in the generated environment
This change allows 'ghc-mod' to be included in such a GHC environment,
which is important because the tool is GHC version-specific.
2013-03-15 19:58:08 +01:00
Peter Simons 97faa4c319 ghc-with-packages.nix: include man pages in the generated profile 2013-02-11 23:26:06 +01:00
Andres Loeh d068aa9861 Patch ghc-paths to interact better with ghcWithPackages.
When the ghc-paths library is compiled, the paths of the
compiler it is compiled with are being hardcoded in the
library (and can then be queried from other applications
using the library).

But on Nix, packages are compiled with ghc-wrapper, and
subsequently possibly used with a special version of ghc
generated for a particular environment of packages. So
one version of ghc-paths may potentially end up being
used by lots of different instances of ghc. The hardcoding
approach fails.

As a work-around, we now patch ghc-paths so that it allows
setting the paths that can be queried via environment
variables. Specific GHC environments can then set these
environment variables in the wrapper shell script that
invokes GHC.

This should at least partially solve issue #213.
2012-12-16 14:25:15 +01:00
Peter Simons 3a34ac175f pkgs/development/compilers/ghc/with-packages.nix: include bash completion files in the generated environment 2012-09-25 15:05:49 +02:00
Andres Löh 789df7619e Updated GHC HEAD snapshot.
svn path=/nixpkgs/trunk/; revision=34379
2012-06-08 08:25:30 +00:00
Peter Simons 115b3d943a pkgs/development/compilers/ghc/with-packages.nix: renamed this expression from "ghc-${ghc.version}-linkdir" to "haskell-env-${ghc.name}"
This change allows use of the with-packages wrapper in user profiles that are
being updated with "nix-env -u \*". The previous name this expression generated
was considered by Nix to be an older version of "ghc-7.0.4-wrapper", because
that name has a higher priority.

svn path=/nixpkgs/trunk/; revision=33325
2012-03-21 11:46:15 +00:00
Peter Simons d8e65ee71d pkgs/development/compilers/ghc/with-packages.nix: trivial changes to fix syntax highlighting in Emacs
svn path=/nixpkgs/trunk/; revision=33324
2012-03-21 11:46:12 +00:00
Eelco Dolstra c556a6ea46 * "ensureDir" -> "mkdir -p". "ensureDir" is a rather pointless
function, so obsolete it.

svn path=/nixpkgs/branches/stdenv-updates/; revision=31644
2012-01-18 20:16:00 +00:00
Andres Löh 64c0b00bbd Linking the complete topdir of GHC in ghc-with-packages.
svn path=/nixpkgs/trunk/; revision=30826
2011-12-11 17:19:36 +00:00
Andres Löh de5d98eff8 Prevent link collisions by linking only Haskell packages.
svn path=/nixpkgs/trunk/; revision=30727
2011-12-04 17:45:12 +00:00
Andres Löh f237a3a418 Extended ghcWithPackages to link binaries.
svn path=/nixpkgs/trunk/; revision=30726
2011-12-04 16:07:39 +00:00
Andres Löh ecf037f2f7 Added a wrapper function to produce a GHC with a predefined set of packages.
svn path=/nixpkgs/trunk/; revision=30716
2011-12-03 16:19:43 +00:00