NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.38k stars 14.33k forks source link

pkgs.haskellPlatform does not ghc-pkg check ? #1987

Closed PierreR closed 10 years ago

PierreR commented 10 years ago

[with nixos-13.10, stable channel]

If I install the haskell platform for my user profile using:

nix-env -iA nixos.pkgs.haskellPlatform

Then when I try ghc-pkg check I have got:

 dependency "GLURaw-1.3.0.0-627263de96d07e156cd8167e3c9f76eb" doesn't exist
  dependency "GLUT-2.4.0.0-2c46d0f5c227309ad49184ee6bf71e08" doesn't exist
  dependency "HTTP-4000.2.8-6788f1ac7b252cd9ff5198b0a5e23b83" doesn't exist
  dependency "OpenGL-2.8.0.0-8f8df8b8299a702ebe5c012db1a925ad" doesn't exist
  dependency "OpenGLRaw-1.3.0.0-d2ca2b14bee8516c3722915f732066b8" doesn't exist
  dependency "async-2.0.1.4-d29f6bf65afd0a094e35ee464180fb08" doesn't exist
  dependency "cgi-3001.1.7.5-abef6f22c50700a86fb9d455e53ed771" doesn't exist
  dependency "fgl-5.4.2.4-1de936d1c358d100e2ed7e552ca82329" doesn't exist
  dependency "haskell-src-1.0.1.5-99ca33353f8f26110c8ce727f95cd08d" doesn't exist
  dependency "html-1.0.1.2-1cf694b8a6365e3aea2eb6674da7cda2" doesn't exist
  dependency "parallel-3.2.0.3-6c739108b875f38c2a1660d762abf7d7" doesn't exist
  dependency "regex-base-0.93.2-0be531b5a93237f43bfe70c4053557b3" doesn't exist
  dependency "regex-compat-0.95.1-b476123886f421ea121e1b4a5f528a3a" doesn't exist
  dependency "regex-posix-0.95.2-2a7ff3caa8dc8c6e396f49934bfeabdd" doesn't exist
  dependency "xhtml-3000.2.1-af6c07102e2c4b1e6d1613cfdff5851c" doesn't exist
There are problems in package haskell-platform-2013.2.0.0:

I have removed ~/.cabal to be sure there is no interference but without success.

peti commented 10 years ago

This is a known deficiency in the ghc-wrapper script. Internal packages, i.e. packages that belong to the GHC distribution, don't show up during ghc-pkg list. Nonetheless, these packages do exist and they will be found just fine during compilation.

If this error message concerns you, then you might want to checkout out the ghcWithPackages function. https://nixos.org/wiki/Haskell#Customized_GHC_environment has some documentation about that.

PierreR commented 10 years ago

Ok, thanks. I guess I am now facing #1438, isn't ?

peti commented 10 years ago

You might, depending on your choice of libraries. You can always use ghcWithLibrariesOld if you don't care about collisions.

PierreR commented 10 years ago

Just asking for an advice here. I am coming from Arch ... I start wondering if it is such a good idea to use the haskellPlatform at all ... If I need the latest versions of many packages (such as attoparsec and such) I guess I can just use a customized GHC environment and specify all needed haskell libraries in ~/.nixpgks/config.nix ?

peti commented 10 years ago

Yes, exactly. Personally, I use the following setup in my config.nix:

# ~/.nixpkgs/config.nix

let
  haskellEnv = haskellPackages: with haskellPackages; [
    # Haskell Platform
    async attoparsec caseInsensitive cgi fgl GLUT GLURaw haskellSrc
    hashable html HTTP HUnit mtl network OpenGL OpenGLRaw parallel
    parsec QuickCheck random regexBase regexCompat regexPosix split stm
    syb text transformers unorderedContainers vector xhtml zlib
    cabalInstall_1_18_0_3 /*alex_3_1_3*/ /*haddock*/ /*happy_1_19_2*/ primitive
    # other packages
    cmdlib dimensional funcmp hackageDb hlint hoogle HStringTemplate
    monadPar pandoc smallcheck tar uulib permutation criterion graphviz
    async hspec HList dimensionalTf doctest testFramework monadLoops
    testFrameworkHunit wlPprint polyparse uuParsinglib monadPeel
    hashtables terminalProgressBar systemFilepath systemFileio arithmoi
    modularArithmetic lens ghcPaths dataMemocombinators nats
    # tools
    BNFC
    ghcMod
    xmonad xmonadContrib xmonadExtras xmobar
  ];
in
{
  packageOverrides = pkgs:
  {
    ghcDevEnv = pkgs.haskellPackages.ghcWithPackages haskellEnv;
  };
}

I commented a few packages out because to avoid collisions (they were picked up as dependencies from other libraries already and thus ended up being included twice in that list), but it's always possible to fall back to ghcWithLibrariesOld if this kind of stuff gets too tedious. We should really make our wrapper more intelligent to avoid these kind of issues in the first place, but so far the problems haven't been serious enough to motivate anyone to tackle this.