[Nix-dev] Re: cabal not working well out the box

Paul van der Walt paul at denknerd.nl
Tue Dec 28 14:16:04 CET 2010


Hi all,

On Fri, Dec 24, 2010 at 12:24:42PM +0100, Peter Simons wrote:
> from the sound of it, you have discovered a bug in the cabal-install
> expression. The build procedure performed by cabal-install requires
> 'binutils', apparently, but that package isn't listed as a dependency, nor
> is it included in $PATH. Consequently, builds performed by cabal-install
> fail -- unless if 'binutils' is in $PATH by chance, i.e. because you
> manually installed it there.
> 
> The proper way to fix this problem would be to create a wrapper around
> cabal-install, which ensures that required tools like 'ar' can be found in
> the current environment. I'll probably be able to fix this, but it will take
> a few days to get it done because I don't have access to a machine with Nix
> installed right now.

It took me far too long, but I came up with the following patch
to the cabal derivation. My objective is that on an otherwise
clean system, `nix-env -i cabal-install` gives you a working
(i.e. things like `cabal install uu-parsinglib` work) Cabal environment.

Now, I'm not sure if this solution is at all 'nice', so if
somebody disagrees, I'm open to constructive criticism. The
thing is, I've only patched the 0.8.2 cabal derivation, while
0.8.0 and 0.6.2 are also available and presumably suffering from
  the same issues (namely no binutils or ghc installed by
default).

Cheers,
Paul

----

Index: pkgs/tools/package-management/cabal-install/0.8.2.nix
===================================================================
--- pkgs/tools/package-management/cabal-install/0.8.2.nix       (revision 25247)
+++ pkgs/tools/package-management/cabal-install/0.8.2.nix       (working copy)
@@ -1,4 +1,4 @@
-{cabal, HTTP, network, zlib} :
+{cabal, HTTP, network, zlib, binutils, ghc} :

 cabal.mkDerivation (self : {
   pname = "cabal-install";
@@ -7,6 +7,11 @@
   sha256 = "8f896ab46ec6c578f620ce4150f7cd04a2088be793113b33cc570b13b6b86e0b";
   extraBuildInputs = [HTTP network zlib];

+  postInstall = ''
+    mkdir -p $out/nix-support
+    echo ${binutils} ${ghc} > $out/nix-support/propagated-user-env-packages
+  '';
+
   meta = {
     description = "The command-line interface for Cabal and Hackage";
   };

-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20101228/daf70c10/attachment.bin 


More information about the nix-dev mailing list