Skip to content

Latest commit

 

History

History

static-stack

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Fully statically linked stack

This builds a fully statically linked stack executable that should work on any 64-bit Linux distribution.

It uses nix to build everything, including ghc, against the musl libc.

Building

$(nix-build --no-link -A fullBuildScript --argstr stackDir /absolute/path/to/stack/source)

We use the $(nix-build ...) script approach in order to pin the version of nix itself for reproducibility, and because the call to stack2nix needs Internet access and thus has to run outside of the nix build sandbox.

If you get an error such as:

stack2nix: user error (No such package foo-1.2.3.4 in the cabal database. Did you run cabal update?)

then update the hackageSnapshot date in default.nix to a date that includes the package and version.

Binary caches for faster building (optional)

You can use the caches described in the top-level README for faster building.

stack binaries

Static stack binaries I built this way, for download: