From ffcd38403e8d20745d6fefd9e044bcc4a200e342 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 18 Apr 2009 20:24:36 +0000 Subject: [PATCH] * Install the package config files under $out/lib/ghc-pkgs/ghc-/.conf instead of under $out/nix-support/ghc-package.conf. This makes them visible in the user's profile when installed with nix-env. svn path=/nixpkgs/trunk/; revision=15135 --- pkgs/development/compilers/ghc/setup-hook.sh | 9 +++++---- pkgs/development/compilers/ghc/wrapper.nix | 1 + pkgs/development/libraries/haskell/cabal/cabal.nix | 5 +++-- pkgs/top-level/haskell-packages.nix | 10 ++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/ghc/setup-hook.sh b/pkgs/development/compilers/ghc/setup-hook.sh index dc7066f31b67..5027d6536f1f 100644 --- a/pkgs/development/compilers/ghc/setup-hook.sh +++ b/pkgs/development/compilers/ghc/setup-hook.sh @@ -7,10 +7,11 @@ export GHC_PACKAGE_PATH=$packages_db # Env hook to add packages to the package config addLibToPackageConf () { - local confFile=$1/nix-support/ghc-package.conf - if test -f $confFile; then - @ghc@/bin/ghc-pkg register $confFile - fi + local fn + shopt -s nullglob + for fn in $1/lib/ghc-pkgs/ghc-@ghcVersion@/*.conf; do + @ghc@/bin/ghc-pkg register $fn + done } envHooks=(${envHooks[@]} addLibToPackageConf) diff --git a/pkgs/development/compilers/ghc/wrapper.nix b/pkgs/development/compilers/ghc/wrapper.nix index 020363d20a93..e0b705265013 100644 --- a/pkgs/development/compilers/ghc/wrapper.nix +++ b/pkgs/development/compilers/ghc/wrapper.nix @@ -11,4 +11,5 @@ stdenv.mkDerivation { setupHook = ./setup-hook.sh; inherit ghc; + ghcVersion = ghc.version; } diff --git a/pkgs/development/libraries/haskell/cabal/cabal.nix b/pkgs/development/libraries/haskell/cabal/cabal.nix index d76916963bae..c3b8037cd3be 100644 --- a/pkgs/development/libraries/haskell/cabal/cabal.nix +++ b/pkgs/development/libraries/haskell/cabal/cabal.nix @@ -79,8 +79,9 @@ attrs : ./Setup copy - ensureDir $out/nix-support - ./Setup register --gen-pkg-config=$out/nix-support/ghc-package.conf + local confDir=$out/lib/ghc-pkgs/ghc-${attrs.ghc.ghc.version} + ensureDir $confDir + ./Setup register --gen-pkg-config=$confDir/${self.fname}.conf eval "$postInstall" ''; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 5bb225e52ef0..5619be1a6b78 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1,12 +1,18 @@ {pkgs, ghc}: -let ghcOrig = ghc; in +let ghcReal = ghc; in rec { + inherit ghcReal; + + # In the remainder, `ghc' refers to the wrapper. This is because + # it's never useful to use the wrapped GHC (`ghcReal'), as the + # wrapper provides essential functionality: the ability to find + # Haskell packages in the buildInputs automatically. ghc = import ../development/compilers/ghc/wrapper.nix { inherit (pkgs) stdenv; - ghc = ghcOrig; + ghc = ghcReal; }; cabal = import ../development/libraries/haskell/cabal/cabal.nix {