[Nix-dev] Using several versions of GHC at once

Patrick Wheeler patrick.john.wheeler at gmail.com
Thu Jun 20 15:13:45 CEST 2013


I think you are looking for the `--preserve-installed` flag.

 # nix-env -iA nixpkgs.haskellPackages_ghc6104.ghc
 # nix-env --preserve-installed -iA nixpkgs.haskellPackages_ghc762.ghc

in this case ghc is mapped to ghc-6.10.4 and `ghc-7.6.2` is of course
mapped to ghc-7.6.2.

Patrick


On Tue, Jun 11, 2013 at 6:19 PM, Nikita Karetnikov <nikita at karetnikov.org>wrote:

> I'm trying to install several versions of GHC.  There are two
> problems:
>
> 1. According to this page [1], it should be possible to use multiple
>    versions at once.  But 'nix-env -iA' always replaces the previous
>    version.  For example, if I run the following commands:
>
>    # nix-env -iA nixpkgs.haskellPackages_ghc6104.ghc
>    # nix-env -iA nixpkgs.haskellPackages_ghc762.ghc
>
>    my profile will only contain 'ghc-7.6.2', not both.  I can "switch"
>    to 6.10.4 if I execute the first command again.  But the mentioned
>    page says that it's only necessary "to invoke the versioned binaries
>    [...] in order to get the correct instance."
>
> 2. At least two packages fail to install and I'm not sure how to fix
>    that:
>
>    # nix-env -iA nixpkgs.haskellPackages_ghc6121.ghc
>    replacing old `ghc-6.10.4-wrapper'
>    installing `ghc-6.12.1-wrapper'
>    these derivations will be built:
>    /nix/store/47gc3i410nyzmjkd1r75x7r0g2w04bj6-ghc-6.10.1-binary.drv
>    /nix/store/i7ag249kahjdsvy8nsqqbjms0x4rdqdv-ghc-6.12.1-wrapper.drv
>    /nix/store/phlg265h0xi3ggj4sw9hwg0aijzkyhm5-ghc-6.12.1.drv
>    building path(s)
> `/nix/store/w6arbz8j98w51w1y830ym0aighjngs9m-ghc-6.10.1-binary'
>    building /nix/store/w6arbz8j98w51w1y830ym0aighjngs9m-ghc-6.10.1-binary
>    unpacking sources
>    unpacking source archive
> /nix/store/b1vg6v3gih9nl7v7vc28biv9qxixxnff-ghc-6.10.1-i386-unknown-linux.tar.bz2
>    source root is ghc-6.10.1
>    missing ELF header
>    not an ELF executable
>    not an ELF executable
>    not an ELF executable
>    not an ELF executable
>    not an ELF executable
>    patching sources
>    configuring
>    /nix/store/f2rwkyd9yb6s5cdvmy7ydh9yd5bqd1hi-stdenv/setup: ./configure:
> /bin/sh: bad interpreter: No such file or directory
>    builder for
> `/nix/store/47gc3i410nyzmjkd1r75x7r0g2w04bj6-ghc-6.10.1-binary.drv' failed
> with exit code 126
>    cannot build derivation
> `/nix/store/phlg265h0xi3ggj4sw9hwg0aijzkyhm5-ghc-6.12.1.drv': 1
> dependencies couldn't be built
>    cannot build derivation
> `/nix/store/i7ag249kahjdsvy8nsqqbjms0x4rdqdv-ghc-6.12.1-wrapper.drv': 1
> dependencies couldn't be built
>    error: build of
> `/nix/store/i7ag249kahjdsvy8nsqqbjms0x4rdqdv-ghc-6.12.1-wrapper.drv' failed
>
>    Why is it trying to build 'binary' for 6.10.1?
>
>    Here is my '/usr/local/etc/nix/nix.conf':
>
>    build-users-group = nixbld
>    build-use-chroot = true
>    build-chroot-dirs = /dev /proc /bin
>
>    # nix-env -iA nixpkgs.haskellPackages_ghc6104.binary
>    installing `haskell-binary-ghc6.10.4-0.7.1.0'
>    these derivations will be built:
>    /nix/store/all8ad8p8sy28dzcxqvy7b9sminvvvl5-binary-0.7.1.0.tar.gz.drv
>
>  /nix/store/f89qf3z81qchzy5y9ls9mnqrknnp53xw-haskell-binary-ghc6.10.4-0.7.1.0.drv
>    /nix/store/j2p6lck8jcgxzwmavpxm6fbc0b4vipav-mirrors-list.drv
>
>    [...]
>
>    [1 of 1] Compiling Main             ( Setup.lhs, Setup.o )
>    Linking Setup ...
>    configure flags: --disable-library-profiling --enable-split-objs
>    Warning: binary.cabal: This package requires Cabal version: >=1.8
>    Warning: binary.cabal: Ignoring unknown section type: test-suite
>    Warning: binary.cabal: Ignoring unknown section type: test-suite
>    Warning: binary.cabal: Ignoring unknown section type: benchmark
>    Warning: binary.cabal: Ignoring unknown section type: benchmark
>    Warning: binary.cabal: Ignoring unknown section type: benchmark
>    Error: This package requires Cabal version: >=1.8
>    Configuring binary-0.7.1.0...
>    Flags chosen: development=False
>    builder for
> `/nix/store/f89qf3z81qchzy5y9ls9mnqrknnp53xw-haskell-binary-ghc6.10.4-0.7.1.0.drv'
> failed with exit code 1
>    error: build of
> `/nix/store/f89qf3z81qchzy5y9ls9mnqrknnp53xw-haskell-binary-ghc6.10.4-0.7.1.0.drv'
> failed
>
>    I tried to install 'cabal-install' and several versions of
>    'nixpkgs.haskellPackages_ghc6104.cabalInstall'.  It didn't help.
>
>    (Note that I don't use NixOS, just Nix.)
>
> [1] http://nixos.org/wiki/Haskell#Using_several_versions_of_GHC_at_once
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>


-- 
Patrick Wheeler
Patrick.John.Wheeler at gmail.com
Patrick.J.Wheeler at rice.edu
Patrick.Wheeler at colorado.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20130620/a1993414/attachment.html 


More information about the nix-dev mailing list