From 27905ce17e1b1aed55edbff5856082b8c1b51fc7 Mon Sep 17 00:00:00 2001
From: Gergely Risko <gergely@risko.hu>
Date: Mon, 26 Aug 2013 11:59:51 +0200
Subject: [PATCH] pkgs/build-support/cabal: set LANG="en_US.UTF-8" for the
 Haddock run

Haskell packages that contain non-ascii characters in their .cabal file
or somewhere else in their haddock documentation fail to compile under
nixpkgs and usually flagged with noHaddock = true. I wanted to do the
same for modularArithmentic, when I realized that we just have to set
the locale to some UTF-8 compatible locale in build-support/cabal to fix
this issue correctly.
---
 pkgs/build-support/cabal/default.nix | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 6ede3f56923..d57afb7bf9d 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -147,7 +147,11 @@ assert enableCheckPhase -> stdenv.lib.versionOlder "7" ghc.ghcVersion;
               ./Setup build
 
               export GHC_PACKAGE_PATH=$(${ghc.GHCPackages})
-              [ -n "$noHaddock" ] || ./Setup haddock
+              if [ -n "$noHaddock" ]; then
+                export LANG="en_US.UTF-8"
+                ./Setup haddock
+                unset LANG
+              fi
 
               eval "$postBuild"
             '';