NixOS/nixpkgs — pull request #3194 by vcunat (2014-07-06 11:53:10+00:00)
Title: haskellPackages: add ghcForStatic

It's built with gmp that contains static libraries as well,
so one is able to build statically linked haskell programs.

Example:
```
$ echo "main = undefined" > test.hs

$ ghc -optl-static -optl-pthread test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
/nix/store/1qqhbh9w3mhsl48bsn73ln68ixxv7frz-ghc-7.6.3/lib/ghc-7.6.3/libHSrts.a(Linker.o): In function `addDLL':
Linker.c:(.text+0x1a19): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

$ ldd ./test
not a dynamic executable
```

**This is just a proof of concept:**
- I don't really use Haskell for anything, so it's likely that a different way of plugging into haskellPackages will be better. CC: @peti, etc.?
- It's probable that when using stuff linked against more non-haskell libs, the static part of those might be missing.