@@ -170,6 +170,8 @@ Advantages of haskell.nix:
170170 (without also requiring a ` stack.yaml.lock ` file).
171171- A shared cache from IOHK. (Although users commonly report not
172172 getting cache hits for various reasons.)
173+ - The ability to cross-compile Haskell libraries. (For instance,
174+ building an ARM64 binary on an x86_64 machine.)
173175
174176Advantages of ` stacklock2nix ` :
175177
@@ -205,3 +207,26 @@ PRs, and helping people who run into problems. I prioritize issues and PRs
205207from people who are sponsors.
206208
207209You can find the sponsor page [ here] ( https://github.com/sponsors/cdepillabout ) .
210+
211+ ## FAQ
212+
213+ - ** Is it possible to use ` stacklock2nix ` to build a statically-linked Haskell library?**
214+
215+ Recent versions (since mid-2022) of the Haskell infrastructure in Nixpkgs
216+ have the ability to link Haskell executables completely statically. An
217+ easy way to test this out is to use the
218+ [ ` pkgsStatic ` subpackage set] ( https://functor.tokyo/blog/2021-10-20-nix-cross-static )
219+ in Nixpkgs.
220+
221+ Instead of passing a value like ` pkgs.haskell.packages.ghc924 ` to the
222+ ` baseHaskellPkgSet ` of the ` stacklock2nix ` function, pass
223+ ` pkgs.pkgsStatic.haskell.packages.ghc924 ` :
224+
225+ ``` nix
226+ my-haskell-stacklock = final.stacklock2nix {
227+ stackYaml = ./stack.yaml;
228+ baseHaskellPkgSet = final.pkgsStatic.haskell.packages.ghc924;
229+ callPackage = final.pkgsStatic.callPackage;
230+ ...
231+ };
232+ ```
0 commit comments