NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.75k stars 13.86k forks source link

ghc-mod --help doesn't work #6104

Closed miguel-negrao closed 9 years ago

miguel-negrao commented 9 years ago
[nix-shell:~/bin]$ ghc-mod --help
.ghc-mod-wrapped: Parsing command line options failed: unrecognized option `--help'

[nix-shell:~/bin]$ nix-env -qaP | grep ghc-mod
...
nixpkgs.haskellPackages.ghcMod                      haskell-ghc-mod-ghc7.8.3-5.2.1.1-shared
peti commented 9 years ago

The version from haskellngPackages doesn't seem to have that problem; --help works fine for me.

miguel-negrao commented 9 years ago

Ok, just read now about Haskell NG, I wasn't aware of it. Is there an official documentation for it ?

peti commented 9 years ago

See https://github.com/NixOS/nixpkgs/issues/4941.

miguel-negrao commented 9 years ago

I've updated my nix (unstable channel) but I don't seem to be able to install ghc-mod:

miguel@miguel-MacBookPro:~$ nix-env -iA nixpkgs.haskellPackages.ghcMod
installing ‘haskell-ghc-mod-ghc7.8.4-5.2.1.2-shared’
these derivations will be built:
  /nix/store/5b7n2n7r22cqhj6sgkmhsy20hpxzif5q-haskell-monad-journal-ghc7.8.4-0.5.0.1-shared.drv
  /nix/store/2a1ryjb1gyfxlpvczr9aagjffp5q9pn7-haskell-ghc-mod-ghc7.8.4-5.2.1.2-shared.drv
building path(s) ‘/nix/store/pzcdchqqapca72a5xqpcm6a8mgabnn0j-haskell-monad-journal-ghc7.8.4-0.5.0.1-shared’
building /nix/store/pzcdchqqapca72a5xqpcm6a8mgabnn0j-haskell-monad-journal-ghc7.8.4-0.5.0.1-shared
unpacking sources
unpacking source archive /nix/store/38ykadyl1plci53pydcd5ahw35h49p99-monad-journal-0.5.0.1.tar.gz
source root is monad-journal-0.5.0.1
patching sources
configuring
[1 of 1] Compiling Main             ( Setup.hs, /tmp/nix-build-haskell-monad-journal-ghc7.8.4-0.5.0.1-shared.drv-0/Main.o )
Linking Setup ...
configure flags: --enable-split-objs --disable-library-profiling --enable-shared --enable-library-vanilla --enable-executable-dynamic --enable-tests  --with-gcc=cc --ghc-option=-optl=-Wl,-rpath=/nix/store/pzcdchqqapca72a5xqpcm6a8mgabnn0j-haskell-monad-journal-ghc7.8.4-0.5.0.1-shared/lib/ghc-7.8.4/monad-journal-0.5.0.1
Configuring monad-journal-0.5.0.1...
Setup: At least the following dependencies are missing:
monad-control ==0.3.*
builder for ‘/nix/store/5b7n2n7r22cqhj6sgkmhsy20hpxzif5q-haskell-monad-journal-ghc7.8.4-0.5.0.1-shared.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/2a1ryjb1gyfxlpvczr9aagjffp5q9pn7-haskell-ghc-mod-ghc7.8.4-5.2.1.2-shared.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/2a1ryjb1gyfxlpvczr9aagjffp5q9pn7-haskell-ghc-mod-ghc7.8.4-5.2.1.2-shared.drv’ failed
peti commented 9 years ago

Dude, just use the one from the haskell-ng package set!

miguel-negrao commented 9 years ago

Ok, it seems ghc-mod is now installing from the unstable channel.

I think it will take me a while to figure out how to use the haskellngPackages. I've mostly been using nix to setup an environment for each project by having a default.nix like below and doing nix-shell and then working with emacs, ghc-mod and ghc.

{ haskellPackages ? (import <nixpkgs> {}).haskellPackages }:

haskellPackages.cabal.mkDerivation (self: {
  pname = "blah";
  version = "0.1.0";
  src = ./.;
  buildDepends =  with haskellPackages; [scotty acidState blazeHtml JuicyPixels Rasterific];
  buildTools =  with haskellPackages; [ cabalInstall ghcMod ];
  enableSplitObjs = false;
})

How would I migrate such a default.nix to haskellngPackages ?

peti commented 9 years ago

Have you read the documentation the ticket lists that I referred to?

miguel-negrao commented 9 years ago

Yes, I've read both guides, but I have only a rudimentary understanding of nix. The documentation mentions environments created through ghcWithPackages in ~/.nixpkgs but it doesn't say anything about per project default.nix files which I use[1], and I don't have a good enough understanding of nix to get it on my own. Is it the case that with haskellng I should just have a global haskell environment for all (most) haskell projects created through ghcWithPackages in ~/.nixpkgs/config.nix and possibly different such environments installed into different profiles for quick changing if some project conflicts with the default environment (i.e. if I need to use a different version of some package) ?

[1] based on this: https://ocharles.org.uk/blog/posts/2014-02-04-how-i-develop-with-nixos.html

peti commented 9 years ago

If you follow the threads on the mailing list that the two postings started, then you'll find detailed instructions how to set-up shell.nix. This topic has been discussed in detail. There is also ocharles Wiki with instructions, which is also a link in the ticket I referred to.

If you have any further questions, then it would probably be best to ask on the #nixos IRC channel or to post them to the nix-dev mailing list.

miguel-negrao commented 9 years ago

Ah, ok, I think the wiki entry of ocharles is indeed what I was looking for. Thanks.