[Nix-dev] How to use wxHaskell? (example for building ghc packages)

Cat Dancer nix at catdancer.ws
Sat Apr 28 15:53:31 CEST 2007


This may be more of a ghc question than a Nix question, but here goes...

I'm interested in writing a Nix expression for a Haskell library, so I
took a look at the wxHaskell package to see how a ghc library might be
referenced in a Nix environment.  (I assume we can't use the ghc
package manager, since it isn't functional).

I installed wxHaskell (nix-env -i wxHaskell) and I see it in
~/.nix-profile/lib/imports

My little test program X.hs:

    module Main where

    import Graphics.UI.WX

    main = do
      putStrLn "great!"

(I've never used wxHaskell, so this might be wrong too).

So how to get ghc to see the library?

$ ghc -i~/.nix-profile/lib/imports -v X.hs
Glasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC
version 6.6
Using package config file:
/nix/store/9rhf6qccv7jfcnvwxhlh0qdnx15pnpqi-ghc-6.6/lib/ghc-6.6/package.conf
[ ... ]
X.hs:3:0:
    Failed to load interface for `Graphics.UI.WX':
      locations searched:
        Graphics/UI/WX.hi
        Graphics/UI/WX.hi-boot
        ~/.nix-profile/lib/imports/Graphics/UI/WX.hi
        ~/.nix-profile/lib/imports/Graphics/UI/WX.hi-boot
[...]

Which is strange since ~/.nix-profile/lib/imports/Graphics/UI/WX.hi
does in fact exist.


or maybe do use ghc-pkg?

$ cd /nix/store/7clm036mcrp377wpjq5hgr39ypk2qgs0-wxHaskell-0.10.1-pre20070124/lib
$ ghc-pkg --user register wx.pkg
Reading package info from "wx.pkg" ... ghc-pkg: Unable to expand
variable "wxhlibdir" (use --force to override)


Any ideas?

Thanks!



More information about the nix-dev mailing list