diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix index 7f4d431c0076..a1dc68e6484a 100644 --- a/pkgs/build-support/cabal/default.nix +++ b/pkgs/build-support/cabal/default.nix @@ -1,6 +1,6 @@ # generic builder for Cabal packages -{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal +{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, glibcLocales , enableLibraryProfiling ? false , enableCheckPhase ? true }: @@ -112,6 +112,10 @@ assert enableCheckPhase -> stdenv.lib.versionOlder "7" ghc.ghcVersion; (stdenv.lib.enableFeature self.enableSplitObjs "split-objs") ] ++ stdenv.lib.optional (stdenv.lib.versionOlder "7" ghc.ghcVersion) (stdenv.lib.enableFeature self.doCheck "tests"); + # GHC needs the locale configured during the Haddock phase. + LANG = "en_US.UTF-8"; + LOCALE_ARCHIVE = lib.optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; + # compiles Setup and configures configurePhase = '' eval "$preConfigure" @@ -150,11 +154,7 @@ assert enableCheckPhase -> stdenv.lib.versionOlder "7" ghc.ghcVersion; ./Setup build export GHC_PACKAGE_PATH=$(${ghc.GHCPackages}) - if [ -z "$noHaddock" ]; then - export LANG="en_US.UTF-8" - ./Setup haddock - unset LANG - fi + test -n "$noHaddock" || ./Setup haddock eval "$postBuild" ''; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 07623af281fa..44b616667492 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -105,6 +105,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y); cabal = callPackage ../build-support/cabal { enableLibraryProfiling = enableLibraryProfiling; enableCheckPhase = pkgs.stdenv.lib.versionOlder "7.4" self.ghc.ghcVersion; + glibcLocales = if pkgs.stdenv.isLinux then pkgs.glibcLocales else null; }; # A variant of the cabal build driver that disables unit testing.