summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-11-14 12:32:51 -0800
committerWilliam A. Kennington III <william@wkennington.com>2015-11-14 12:32:51 -0800
commit6602f49495c94e8533c8b482698bcf570a8d8933 (patch)
tree07065424002052ed9e726b4feb689697845ff4a7 /doc
parente4feccce818416c39c8e86e6f9ac01674ad98c88 (diff)
downloadnixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.tar
nixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.tar.gz
nixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.tar.bz2
nixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.tar.lz
nixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.tar.xz
nixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.tar.zst
nixpkgs-6602f49495c94e8533c8b482698bcf570a8d8933.zip
Revert "Revert "Merge pull request #9543 from NixOS/staging.post-15.06""
This reverts commit 741bf840dad05cd1728481045466811ae8ae8281.

This reverts the fallout from reverting the major changes.
Diffstat (limited to 'doc')
-rw-r--r--doc/haskell-users-guide.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/haskell-users-guide.md b/doc/haskell-users-guide.md
index b06a81e5b36..446f08eb697 100644
--- a/doc/haskell-users-guide.md
+++ b/doc/haskell-users-guide.md
@@ -666,6 +666,27 @@ to find out the store path of the system's zlib library. Now, you can
    The same thing applies to `cabal configure`, of course, if you're
    building with `cabal-install` instead of Stack.
 
+## Creating statically linked binaries
+
+There are two levels of static linking. The first option is to configure the
+build with the Cabal flag `--disable-executable-dynamic`. In Nix expressions,
+this can be achieved by setting the attribute:
+
+    enableSharedExecutables = false;
+
+That gives you a binary with statically linked Haskell libraries and
+dynamically linked system libraries.
+
+To link both Haskell libraries and system libraries statically, the additional
+flags `--ghc-option=-optl=-static --ghc-option=-optl=-pthread` need to be used.
+In Nix, this is accomplished with:
+
+    configureFlags = [ "--ghc-option=-optl=-static" "--ghc-option=-optl=-pthread" ];
+
+It's important to realize, however, that most system libraries in Nix are built
+as shared libraries only, i.e. there is just no static library available that
+Cabal could link!
+
 
 # Other resources