Giter Club home page Giter Club logo

static-haskell-nix's Introduction

Funding button Buildkite build status

static-haskell-nix

With this repository you can easily build most Haskell programs into fully static Linux executables.

  • results are fully static executables (ldd says not a dynamic executable)
  • to make that possible, each exe and all dependencies (including ghc) are built against musl instead of glibc

static-haskell-nix can successfully build > 90% of Stackage executables, so chances are high it can build yours.

History

glibc encourages dynamic linking to the extent that correct functionality under static linking is somewhere between difficult and bug-ridden. For this reason, static linking, despite its many advantages (details here) has become less and less common.

Due to GHC's dependency on a libc, and many libraries depending on C libraries for which Linux distributions often do not include static library archive files, this situation has resulted in fully static Haskell programs being extremely hard to produce for the common Haskeller, even though the language is generally well-suited for static linking.

This project solves this.

It was inspired by a blog post by Vaibhav Sagar, and a comment by Will Dietz about musl.

Work on this so far was sponsored largely by my free time, FP Complete and their clients, and the contributors mentioned here.

By now we have a nixpkgs issue on Fully static Haskell executables (progress on which is currently this repo, with plans to later merge it into nixpkgs), and a merged nixpkgs overlay for static nixpkgs in general.

There's also nixpkgs's pkgsStatic package set, which can also build many Haskell packages statically with musl. Differences are:

  • Type of compilation:
    • pkgsStatic uses cross-compilation infrastructure, which is inherently more complex, and more difficult to get into.
    • static-haskell-nix just replaces the libc, and compiles normally. This allows to build packages that cannot (yet) be cross-compiled.
  • .a + .so files:
    • pkgsStatic does exclusively static builds, it generates only .a files and no .so files.
    • static-haskell-nix generates both .a and .so files, which allows more intermediate software to run (e.g. some build systems using Python libraries doing dlopen() on some .so files).
    • In the past, this made a big difference for TemplateHaskell, which worked well only when .so files are present. This seems to have improved. static-haskell-nix now has an off-by-default flag useArchiveFilesForTemplateHaskell that users are encouraged to test.
  • Hacky fixes:
    • static-haskell-nix contains a large amount of per-package fixes for static builds for which we haven't found a way to integrate them cleanly into nixpkgs yet.
  • Pinning:
    • static-haskell-nix does not impede nixpkgs progress, as it is maintained out of the nixkpgs.

In general, any contribution to static-haskell-nix or pkgsStatic benefits the respective other one.

A goal is to shrink static-haskell-nix over time, moving those parts into nixpkgs that do not slow down nixpkgs's fast pace.

Funding

You can support this project financially on OpenCollective. Goals:

  • Dedicated build server - Goal reached! Thanks to our awesome contributors!

    The first and main goal is to get to ~28 EUR/month to buy a cheap Hetzner dedicated build server for fast CI and pushing to Cachix. It will also allow anybody to download almost any executable on Stackage pre-built as a static binary, so that people can try out Haskell programs easily without having to install lots of dependencies.

    Because the server is so cheap, already 1 or 2 EUR/month will bring us to that goal quickly.

Hercules CI Logo The storage infrastructure (Cachix) for downloading pre-built packages is sponsored by the awesome guys from Hercules CI. They are building a nix-based CI service you can safely run on your own infrastructure. static-haskell-nix also uses it.
If your company or project needs that, check Hercules CI out!

Testing

We have multiple CIs:

  • HerculesCI: Builds with pinned nixpkgs. Publicly visible, but requires free sign-in. Click the most recent job to which 100s of binaries we build.
  • BuildKite:
    • Builds with pinned nixpkgs (submodule): Should always be green.
    • Builds with latest nixpkgs unstable, daily: Shows up as Scheduled build. May break when nixpkgs upstream changes.

Building a minimal example (don't use this in practice)

default.nix builds an example executable (originally from https://github.com/vaibhavsagar/experiments). Run:

NIX_PATH=nixpkgs=nixpkgs nix-build --no-link

This prints a path that contains the fully linked static executable in the bin subdirectory.

This example is so that you get the general idea. In practice, you probably want to use one of the approaches from the "Building arbitrary packages" or "Building stack projects" sections below.

Binary caches for faster building (optional)

Install cachix and run cachix use static-haskell-nix before your nix-build.

If you get a warning during cachix use, read this.

If you don't want to install cachix for some reason or cachix use doesn't work, you should also be able to manually set up your nix.conf (e.g. in $HOME/.config/nix/nix.conf; you may have to create the file) to have contents like this:

extra-substituters = http://static-haskell-nix-ci.nh2.me:5000 https://cache.nixos.org https://static-haskell-nix.cachix.org
extra-trusted-public-keys = static-haskell-nix-ci-cache-key:Z7ZpqYFHVs467ctsqZADpjQ/XkSHx6pm5XBZ4KZW3/w= static-haskell-nix.cachix.org-1:Q17HawmAwaM1/BfIxaEDKAxwTOyRVhPG5Ji9K3+FvUU=

or append to command lines:

--option extra-substituters 'http://static-haskell-nix-ci.nh2.me:5000' --option extra-trusted-public-keys 'static-haskell-nix-ci-cache-key:Z7ZpqYFHVs467ctsqZADpjQ/XkSHx6pm5XBZ4KZW3/w='

Note that you may not get cached results if you use a different nix version than I used to produce the cache (I used 2.0.4 as of writing, which you can get from here).

Building arbitrary packages

The survey directory maintains a select set of Haskell executables that are known and not known to work with this approach; contributions are welcome to grow the set of working executables. Run for example:

NIX_PATH=nixpkgs=nixpkgs nix-build --no-link survey/default.nix -A working

There are multiple package sets available in the survey (select via -A):

  • working -- build all exes known to be working
  • notWorking -- build all exes known to be not working (help welcome to make them work)
  • haskellPackages.somePackage -- build a specific package from our overridden package set

If you are a nix user, you can easily import this functionality and add an override to add your own packages.

Building stack projects

The static-stack2nix-builder-example directory shows how to build any stack-based project statically.

Until Stack 2.3, the official static build of stack itself was built using this method (Stack >= 2.3 static builds are built in an Alpine Docker image after GHC on Alpine started working again, see here). The static-stack directory shows how Stack itself can be built statically with static-haskell-nix. stack is a big package with many dependencies, demonstrating that it works also for large projects.

Related important open issues

You can contribute to these to help static Haskell executables:

FAQ

  • I get cannot find section .dynamic. Is this an error?
    • No, this is an informational message printed by patchelf. If your final looks like
      ...
      cannot find section .dynamic
      /nix/store/dax3wjbjfrcwj6r3mafxj5fx6wcg5zbp-stack-2.3.0.1
      
      then /nix/store/dax3wjbjfrcwj6r3mafxj5fx6wcg5zbp-stack-2.3.0.1 is your final output store path whose /bin directory contains your static executable.
  • I get stack2nix: user error (No such package mypackage-1.2.3 in the cabal database. Did you run cabal update?).
    • You most likely have to bump the date like hackageSnapshot = "2019-05-08T00:00:00Z"; to a newer date (past the time that package-version was added to Hackage).
  • I get a linker error. What's a good way to investigate what the linker invocation is?
    • Pass -v to Cabal, and to GHC itself:
      nix-build --expr '(import ./survey/default.nix {}).haskellPackages.YOURPACKAGE.overrideAttrs (old: { configureFlags = (old.configureFlags or []) ++ ["-v" "--ghc-options=-v"]; })'
      Look for *** Linker: in the GHC output.
  • Can I build Stack projects with resolvers that are too old to be supported by Stack >= 2?
    • No. For that you need need to use an old static-haskell-nix version: The one before this PR was merged.
  • I get some other error. Can I just file an issue and have you help me with it?
    • Yes. If possible (especially if your project is open source), please push some code so that your issue can be easily reproduced.

Open questions

  • Nixpkgs issue Provide middle-ground overlay between pkgsMusl and pkgsStatic:

    Should nixpkgs provide a makeStaticAndSharedLibraries adapter to provide a package set? That might be better (but more difficult) than what we do now, with dontDisableStaticOverlay, because:

    • dontDisableStatic is to prevent --disable-static to autoconf, which is really specific to C + autoconf. A package set should do more than that, also for Meson, CMake, etc. nh2 started implementing this idea in nixpkgs branch static-haskell-nix-nixos-24.05-makeStaticAndSharedLibraries.
  • Can we avoid building bootstrap tools?

    • Our current overlays also build xgcc, gcc, binutils, and so on.
    • This is because we override all packages to have e.g. .a files, and some of those are also dependencies of e.g. gcc.
    • pkgsStatic avoids that by being a cross toolchain.
      • But might this cause additional issues? Because cross may have additional complexities when building the actual packages we're interested in, vs just switching the libc ("native" compilation)? Unclear.
    • For now, we accept those additional builds.
  • How should we handle pkg-config regarding static dependencies?

    E.g. libtiff depends on lerc and libtiff-4.pc correctly declares

    Libs.private: -llzma -lLerc -ljpeg -ldeflate -lz -lm
    Requires.private: liblzma libjpeg libdeflate zlib
    

    But the .pc file does not include the path on which libLerc.a can be found, nor does anything in nixpkgs set PKG_CONFIG_PATH such that Lerc.pc is on it. Thus, linking a static binary that uses libtiff-4.pc fails with

    cannot find -lLerc: No such file or directory
    
    • Should we use propagatedBuildInputs for this?
      • Yes! We can use stdenvAdapters.propagateBuildInputs.
        • Current problem: Using that in a native compilation (instead of cross as pkgsMusl does) causes:
          error: build of '/nix/store/...-stdenv-linux.drv' failed: output '/nix/store/...-stdenv-linux' is not allowed to refer to the following paths:
                  /nix/store/...-binutils-patchelfed-ld-wrapper-2.41
                  /nix/store/...-pcre2-10.43-dev
                  /nix/store/...-gmp-with-cxx-6.3.0-dev
                  /nix/store/...-musl-iconv-1.2.3
                  /nix/store/...-binutils-2.41
                  /nix/store/...-bootstrap-tools
          
          • John Ericson explained that the bootstrap rebuild avoidance (mentioned in a point above) also solves this issue for pkgsStatic. So we probably need to do something similar.
    • After fixing that, we still need to fix libtiff to include lerc in Requires.private.

static-haskell-nix's People

Contributors

aver1y avatar borsboom avatar cdepillabout avatar domenkozar avatar dtzwill avatar fptje avatar jonathanlking avatar nh2 avatar nmattia avatar robx avatar rtimush avatar tristancacqueray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

static-haskell-nix's Issues

Can't build Haskell project with PostgreSQL

I am trying to build a simple Haskell project that uses PostgreSQL. I can't get it to statically link successfully. Here are the exact steps I'm going through:

# I'm running Nix inside of Docker.
# I'd imagine the results are the same regardless.
docker run \
  --interactive \
  --rm \
  --tty \
  --volume "$( pwd ):/opt/example" \
  --volume nix:/nix \
  --workdir /opt/example \
  nixos/nix:2.3 \
  sh

# The `allow-different-user` setting is for Docker.
echo 'resolver: lts-14.0
allow-different-user: true' > stack.yaml

# I called this `example-project` so it would match the `default.nix` without changes.
echo 'name: example-project
version: 1
executable:
  main: example-project.hs
  dependencies: [ base, postgresql-simple ]' > package.yaml

# Program won't do anything useful, but it forces libpq to be linked.
echo 'import Database.PostgreSQL.Simple
main = connectPostgreSQL mempty' > example-project.hs

# Get the current latest example Stack project.
nix-env --install wget
sha=ff7715e0e13fb3f615e64a8d8c2e43faa4429b0f
wget --output-document default.nix \
  https://raw.githubusercontent.com/nh2/static-haskell-nix/$sha/static-stack2nix-builder-example/default.nix

# Set up Cachix for caching.
nix-env -i cachix
cachix use static-haskell-nix

# Try to build.
nix-env --install bash
$( nix-build --no-link -A fullBuildScript )

After all of the normal output I get these errors:

Preprocessing executable 'example-project' for example-project-1..
Building executable 'example-project' for example-project-1..
[1 of 2] Compiling Main             ( example-project.hs, dist/build/example-project/example-project-tmp/Main.o )
[2 of 2] Compiling Paths_example_project ( dist/build/example-project/autogen/Paths_example_project.hs, dist/build/example-project/example-project-tmp/Paths_example_project.o )
Linking dist/build/example-project/example-project ...
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `SSLerrmessage':
(.text+0x3b): undefined reference to `ERR_reason_error_string'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `initialize_SSL':
(.text+0x102): undefined reference to `SSLv23_method'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x10a): undefined reference to `SSL_CTX_new'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x12a): undefined reference to `SSL_CTX_ctrl'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13e): undefined reference to `SSL_CTX_ctrl'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1a8): undefined reference to `SSL_new'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1c5): undefined reference to `SSL_set_ex_data'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1e9): undefined reference to `BIO_new'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x20d): undefined reference to `SSL_set_bio'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x224): undefined reference to `BIO_int_ctrl'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x233): undefined reference to `SSL_CTX_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x29c): undefined reference to `ENGINE_by_id'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x2b4): undefined reference to `ENGINE_init'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x2cf): undefined reference to `ENGINE_load_private_key'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x2e7): undefined reference to `SSL_use_PrivateKey'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x381): undefined reference to `SSL_check_private_key'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x38b): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x439): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x4fa): undefined reference to `SSL_CTX_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x5c4): undefined reference to `SSL_use_PrivateKey_file'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x5d2): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x6a4): undefined reference to `SSL_set_verify'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x6cd): undefined reference to `ERR_put_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x6d2): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x716): undefined reference to `SSL_CTX_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x727): undefined reference to `SSL_CTX_use_certificate_chain_file'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x741): undefined reference to `BIO_s_socket'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x804): undefined reference to `SSL_ctrl'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x819): undefined reference to `SSL_CTX_load_verify_locations'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x830): undefined reference to `SSL_CTX_get_cert_store'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x863): undefined reference to `ERR_clear_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x8d0): undefined reference to `X509_STORE_load_locations'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x8e2): undefined reference to `X509_STORE_set_flags'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x922): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x96a): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x9b3): undefined reference to `ENGINE_finish'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x9bf): undefined reference to `ENGINE_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xa06): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xa2f): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xa99): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xafe): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `verify_peer_name_matches_certificate_name':
(.text+0xb55): undefined reference to `ASN1_STRING_data'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xb60): undefined reference to `ASN1_STRING_length'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `my_sock_write':
(.text+0xd41): undefined reference to `BIO_clear_flags'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xd72): undefined reference to `BIO_set_flags'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `my_sock_read':
(.text+0xda1): undefined reference to `BIO_clear_flags'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xdd2): undefined reference to `BIO_set_flags'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `pgtls_read_pending':
(.text+0xe7c): undefined reference to `SSL_pending'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `pgtls_read':
(.text+0xed5): undefined reference to `ERR_clear_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xee6): undefined reference to `SSL_read'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xef7): undefined reference to `SSL_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0xf45): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `pgtls_write':
(.text+0x112a): undefined reference to `ERR_clear_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x113c): undefined reference to `SSL_write'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x114d): undefined reference to `SSL_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1191): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `pgtls_init':
(.text+0x13b1): undefined reference to `CRYPTO_get_id_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13bf): undefined reference to `CRYPTO_get_locking_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13d0): undefined reference to `CRYPTO_set_locking_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13e3): undefined reference to `OPENSSL_config'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13e8): undefined reference to `SSL_library_init'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13ed): undefined reference to `SSL_load_error_strings'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x13f9): undefined reference to `CRYPTO_num_locks'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1424): undefined reference to `CRYPTO_num_locks'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1488): undefined reference to `CRYPTO_set_id_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `pgtls_close':
(.text+0x14c8): undefined reference to `SSL_shutdown'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x14d9): undefined reference to `SSL_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x14fc): undefined reference to `X509_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1518): undefined reference to `ENGINE_finish'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1524): undefined reference to `ENGINE_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1591): undefined reference to `CRYPTO_get_locking_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x15a2): undefined reference to `CRYPTO_get_id_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x15b5): undefined reference to `CRYPTO_set_id_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x15be): undefined reference to `CRYPTO_set_locking_callback'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `pgtls_open_client':
(.text+0x1606): undefined reference to `ERR_clear_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1612): undefined reference to `SSL_connect'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1628): undefined reference to `SSL_get_peer_certificate'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x16d3): undefined reference to `SSL_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x16db): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1755): undefined reference to `X509_get_ext_d2i'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1769): undefined reference to `sk_num'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x17a4): undefined reference to `sk_value'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x180d): undefined reference to `sk_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1851): undefined reference to `ERR_get_error'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x18f8): undefined reference to `X509_get_subject_name'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1916): undefined reference to `X509_NAME_get_index_by_NID'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1930): undefined reference to `X509_NAME_get_entry'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1938): undefined reference to `X509_NAME_ENTRY_get_data'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x19fc): undefined reference to `sk_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1a83): undefined reference to `sk_free'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1a8f): undefined reference to `X509_get_subject_name'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1aad): undefined reference to `X509_NAME_get_index_by_NID'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1ae8): undefined reference to `X509_get_subject_name'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1b04): undefined reference to `X509_NAME_get_index_by_NID'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: /nix/store/s382qh3qk52ldqygi6xjsjm1s36jmrn5-postgresql-9.6.15-lib/lib/libpq.a(fe-secure-openssl.o): in function `PQsslAttribute':
(.text+0x1c7b): undefined reference to `SSL_get_version'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1ca4): undefined reference to `SSL_get_current_compression'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1cc4): undefined reference to `SSL_get_current_cipher'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1cd1): undefined reference to `SSL_CIPHER_get_bits'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1d14): undefined reference to `SSL_get_current_cipher'
/nix/store/bprb8jwawnsfnrmjwvazl3r84869f0g3-binutils-2.31.1/bin/ld: (.text+0x1d1c): undefined reference to `SSL_CIPHER_get_name'
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/5kg1ld5x70ca6f6nazjgpjhfxnwlgz4l-example-project-1.drv' failed with exit code 1
error: build of '/nix/store/5kg1ld5x70ca6f6nazjgpjhfxnwlgz4l-example-project-1.drv' failed

Failed to build cabal2nix

I tried to use callCabal2Nix and got the following linking errors.

../lib/.libs/libsasl2.a(dlopen.o):(.data.rel+0x10): undefined reference to `gssapiv2_server_plug_init'
../lib/.libs/libsasl2.a(dlopen.o):(.data.rel+0x28): undefined reference to `gssapiv2_client_plug_init'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:512: dbconverter-2] Error 1
make[2]: Leaving directory '/tmp/nix-build-cyrus-sasl-2.1.26.drv-0/cyrus-sasl-2.1.26/utils'
make[1]: *** [Makefile:457: all-recursive] Error 1
make[1]: Leaving directory '/tmp/nix-build-cyrus-sasl-2.1.26.drv-0/cyrus-sasl-2.1.26'
make: *** [Makefile:364: all] Error 2
builder for '/nix/store/xfayfd1zx790avva7c9d6r7q4ahj15vr-cyrus-sasl-2.1.26.drv' failed with exit code 2
cannot build derivation '/nix/store/16l4brwp3a094w71da4zk8qd4yi1xdzn-openldap-2.4.46.drv': 1 dependencies couldn't be built
building '/nix/store/zgs53hrw6qlyb32wqraqg8rcfcmil79k-python3-3.6.6.drv'...
cannot build derivation '/nix/store/h2c9gbs6fb5fnscyvwqwlwv3jcb4sncw-apr-util-1.6.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xawqfkgq701fhza101nmfb89iwx1w9c8-subversion-1.10.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/vlabs20b2nhwqidqbfcwhb8lzd4sk7hf-nix-prefetch-svn.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/46vwrr2062wfllqrxi2yh6lc2j46w2w0-nix-prefetch-scripts.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/k27dlmgaz9ys2raq91pd7sz4syalhra1-cabal2nix-2.11.1.drv': 1 dependencies couldn't be built

nixpkgs version:

import ((import <nixpkgs> {}).fetchFromGitHub {
  owner = "NixOS";
  repo = "nixpkgs-channels";
  rev = "f753852e11d72c05cb74d1058ea8b7f6d5dd4748";
  sha256  = "0xvjrsi3j4hzq9cdzqpccxnl9gqc8f5y59lkgqs2s2dkng35zv74";
})

cabal2nix regression-tests fail for empty cabal project on macOS

i use [nix-shell -p cabal-install --run 'cabal new-repl'] create a empty project on MacOS.
when i run nix-build, the cabal2nix regression-tests failed!
i have no idea how to skip it.

{ pkgs ? import (builtins.fetchTarball {url="https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz";}) {}} :

with pkgs;
let
  haskellPackages = pkgs.haskellPackages.override {
    overrides = self: super: {
      # clntsh = oracle-instantclient ;
      cabal2nix = dontCheck super.cabal2nix ;
    } ;
  } ;
  pkg = haskellPackages.developPackage {
    root = ./.;

    modifier = drv: haskell.lib.overrideCabal drv (attrs: {
      buildTools = (attrs.buildTools or []) ++ [haskellPackages.cabal-install haskellPackages.c2hs] ;
      # librarySystemDepends = [ odpic ] ;
    }) ;

  } ;
  # buildInputs = [ oracle-instantclient ] ;
  buildInputs = [ ] ;
in pkg.overrideAttrs(attrs: {
  buildInputs = attrs.buildInputs ++ buildInputs ;
})
Preprocessing test suite 'regression-test' for cabal2nix-2.9.3..
Building test suite 'regression-test' for cabal2nix-2.9.3..
[1 of 1] Compiling Main             ( test/Main.hs, dist/build/regression-test/regression-test-tmp/Main.o )
Linking dist/build/regression-test/regression-test ...
clang-5.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
clang-5.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
running tests
Running 1 test suites...
Test suite regression-test: RUNNING...
regression-tests
  cabal2nix library


    test/golden-test-cases/crypt-sha512.nix:                        FAIL (0.04s)
      --- test/golden-test-cases/crypt-sha512.nix.golden        2018-07-10 13:29:51.000000000 +0000
      +++ test/golden-test-cases/crypt-sha512.nix       2019-05-07 15:13:18.000000000 +0000
      @@ -1,6 +1,5 @@
       { mkDerivation, attoparsec, base, bytestring, cryptohash-sha512
      -, quickcheck-instances, stdenv, tasty, tasty-hunit
      -, tasty-quickcheck
      +, stdenv
       }:
       mkDerivation {
         pname = "crypt-sha512";
      @@ -9,10 +8,6 @@
         libraryHaskellDepends = [
           attoparsec base bytestring cryptohash-sha512
         ];
      -  testHaskellDepends = [
      -    base bytestring quickcheck-instances tasty tasty-hunit
      -    tasty-quickcheck
      -  ];
         homepage = "https://github.com/phadej/crypt-sha512";
         description = "Pure Haskell implelementation for GNU SHA512 crypt algorithm";
         license = stdenv.lib.licenses.bsd3;

    test/golden-test-cases/gl.nix:                                  FAIL (0.06s)
      --- test/golden-test-cases/gl.nix.golden  2018-07-10 13:29:51.000000000 +0000
      +++ test/golden-test-cases/gl.nix 2019-05-07 15:13:20.000000000 +0000
      @@ -1,5 +1,5 @@
       { mkDerivation, base, Cabal, containers, directory, filepath, fixed
      -, half, hxt, libGL, stdenv, transformers
      +, half, hxt, stdenv, transformers
       }:
       mkDerivation {
         pname = "gl";
      @@ -11,7 +11,6 @@
         libraryHaskellDepends = [
           base containers fixed half transformers
         ];
      -  librarySystemDepends = [ libGL ];
         description = "Complete OpenGL raw bindings";
         license = stdenv.lib.licenses.bsd3;
       }

    test/golden-test-cases/iconv.nix:                               FAIL (0.03s)
      --- test/golden-test-cases/iconv.nix.golden       2018-07-10 13:29:51.000000000 +0000
      +++ test/golden-test-cases/iconv.nix      2019-05-07 15:13:21.000000000 +0000
      @@ -1,9 +1,10 @@
      -{ mkDerivation, base, bytestring, stdenv }:
      +{ mkDerivation, base, bytestring, iconv, stdenv }:
       mkDerivation {
         pname = "iconv";
         version = "0.4.1.3";
         sha256 = "deadbeef";
         libraryHaskellDepends = [ base bytestring ];
      +  librarySystemDepends = [ iconv ];
         description = "String encoding conversion";
         license = stdenv.lib.licenses.bsd3;
       }


3 out of 702 tests failed (14.52s)
Test suite regression-test: FAIL
Test suite logged to: dist/test/cabal2nix-2.9.3-regression-test.log
0 of 1 test suites (0 of 1 test cases) passed.
builder for '/nix/store/7d6n51wpnhfrzplrwvf5j6idpy4fwcrf-cabal2nix-2.9.3.drv' failed with exit code 1
cannot build derivation '/nix/store/53rcfnw0llxqnbf4avhqr352ymwn66n3-cabal2nix-static-build.drv': 1 dependencies couldn't be built
error: build of '/nix/store/53rcfnw0llxqnbf4avhqr352ymwn66n3-cabal2nix-static-build.drv' failed

support nix-shell develop-mode.

is it feasible to get nix-shell develop-mode environment?
so [nix-shell --pure --run 'cabal repl'] can be used for develop.

it's space-waste to use different tool for development and build.

cp: missing destination file operand after '/tmp/**/setup-package.conf.d/'

i have no way to pass it when using nix-build,
it report:

[op@my-200 minio-migration]$ nix-build
these derivations will be built:
  /nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv
building '/nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/v2qr71m53qpcgjkbc84iggr72f0zivhw-ghc-8.4.3.
cp: missing destination file operand after '/tmp/nix-build-minio-migration-0.1.0.0.drv-0/setup-package.conf.d/'
Try 'cp --help' for more information.
builder for '/nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv' failed with exit code 1
error: build of '/nix/store/m7f8vn4ry5b79csvikcc396n572wqgyx-minio-migration-0.1.0.0.drv' failed
[op@my-200 minio-migration]$ cat default.nix
{ pkgs ? import (builtins.fetchTarball {url="https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz";}) {}} :

with pkgs;
let
  haskellPackages = pkgs.haskellPackages.override {
    overrides = self: super: with pkgs.haskell.lib; {
      # clntsh = oracle-instantclient ;
      minio-hs = dontCheck super.minio-hs ;
      # conduit = doJailbreak super.conduit ;
    } ;
  } ;
  pkg = haskellPackages.developPackage {
    root = ./.;

    modifier = drv: haskell.lib.overrideCabal drv (attrs: {
      buildTools = (attrs.buildTools or []) ++ [haskellPackages.cabal-install] ;
    }) ;
  } ;
  buildInputs = [ ] ;
in pkg.overrideAttrs(attrs: {
  buildInputs = attrs.buildInputs ++ buildInputs ;
})
[op@my-200 minio-migration]$ cat minio-migration.cabal
cabal-version:       >=1.10
-- Initial package description 'minio-migration.cabal' generated by 'cabal
-- init'.  For further documentation, see
-- http://haskell.org/cabal/users-guide/

name:                minio-migration
version:             0.1.0.0
-- synopsis:
-- description:
-- bug-reports:
license:             BSD3
license-file:        LICENSE
author:              clojurians-org
maintainer:          [email protected]
-- copyright:
-- category:
build-type:          Simple
extra-source-files:  CHANGELOG.md

executable minio-migration
  main-is:             Main.hs
  -- other-modules:
  -- other-extensions:
  build-depends:
      base
    , criterion-measurement
    , conduit
    , minio-hs
    , stm-chans
    , stm-conduit
  hs-source-dirs:      src
  default-language:    Haskell2010
  default-extensions: OverloadedStrings
[op@my-200 minio-migration]$ cat src/Main.hs
module Main where

import Control.Monad.IO.Class (liftIO)
import Data.Function ((&))
import Control.Monad (void, when)
import Network.Minio (
    ConnectInfo(..), Credentials(..)
  , setCreds, setRegion
  , runMinio, makeBucket, bucketExists, listBuckets
  , listObjects
  , fPutObject, defaultPutObjectOptions
  )

import Criterion.Measurement (getCPUTime, getTime, secs)
import Conduit (runConduit, (.|), takeC, mapM_C, lengthC)
import Control.Concurrent (threadDelay)


myCI :: ConnectInfo
myCI = "http://10.132.34.83:9000"
         & setCreds (Credentials "***"
                                 "***")
         & setRegion "us-east-1"

myCIDev :: ConnectInfo
myCIDev = "http://10.132."
         & setCreds (Credentials "***"
                                 "***")
         & setRegion "us-east-1"


main :: IO ()
main = do
  res <- runMinio myCI $ do
    startTs <- liftIO getTime
    liftIO $ putStrLn $ "start ..."

    liftIO $ threadDelay 5000
    {--
    buckets <- listBuckets
    liftIO $ print $ "Top 5 buckets: " ++ show (take 5 buckets)
    bExist <- bucketExists "larluo"
    when (not bExist) $ void $ makeBucket "larluo" Nothing
    liftIO $ putStrLn $ "--> put tgz.nix-2.2.2"

    fPutObject "larluo"
      "tgz.nix-2.2.2"
      "/home/op/my-env/nix.sh.out/tgz.nix-2.2.2"
      defaultPutObjectOptions
    --}
    runConduit $ listObjects "icif.uat" Nothing True
              .| takeC 10
              .| mapM_C (liftIO . print)
    endTs <- liftIO getTime
    return (endTs - startTs)
  case res of
    Left e -> putStrLn $ "operate failed due to " ++ (show e)
    Right duration -> putStrLn (secs duration)

major: symbol not found when building static stack

https://buildkite.com/nh2/static-haskell-nix/builds/273#a06ac192-1741-4de4-bac5-e470c724a6d0

With the latest nixpkgs master upgrade it shows:

[10 of 18] Compiling Pantry.Storage   ( src/Pantry/Storage.hs, dist/build/Pantry/Storage.o )

<no location info>: error:
    <command line>: can't load .so/.DLL for: /nix/store/929njkajlm1bqp6pn42zchgn4pba7qqw-unix-compat-0.5.1/lib/ghc-8.4.4/x86_64-linux-ghc-8.4.4/libHSunix-compat-0.5.1-IZ2l0C7CE13FdrCF8rJfBj-ghc8.4.4.so (Error relocating /nix/store/929njkajlm1bqp6pn42zchgn4pba7qqw-unix-compat-0.5.1/lib/ghc-8.4.4/x86_64-linux-ghc-8.4.4/libHSunix-compat-0.5.1-IZ2l0C7CE13FdrCF8rJfBj-ghc8.4.4.so: major: symbol not found)

Has runtime deps

While it should be a static binary, it still contains links to /nix/store derivations:

$ strings /nix/store/0dsc67qhb1s5sa3f0rkmvan5ngqmazs8-blank-me-up-0.1.0.0-x86_64-unknown-linux-musl/bin/blank-me-up | grep /nix/store
/nix/store/n3akrix0bc6lyvvsy183ygzhr72j75xx-warp-3.2.18.1-x86_64-unknown-linux-musl/bin
/nix/store/n3akrix0bc6lyvvsy183ygzhr72j75xx-warp-3.2.18.1-x86_64-unknown-linux-musl/lib/ghc-8.4.1/warp-3.2.18.1
/nix/store/n3akrix0bc6lyvvsy183ygzhr72j75xx-warp-3.2.18.1-x86_64-unknown-linux-musl/lib/ghc-8.4.1/x86_64-linux-ghc-8.4.1
/nix/store/n3akrix0bc6lyvvsy183ygzhr72j75xx-warp-3.2.18.1-x86_64-unknown-linux-musl/share/x86_64-linux-ghc-8.4.1/warp-3.2.18.1
/nix/store/n3akrix0bc6lyvvsy183ygzhr72j75xx-warp-3.2.18.1-x86_64-unknown-linux-musl/libexec/x86_64-linux-ghc-8.4.1/warp-3.2.18.1
/nix/store/n3akrix0bc6lyvvsy183ygzhr72j75xx-warp-3.2.18.1-x86_64-unknown-linux-musl/etc
/nix/store/4rcafzmp5w40mpcabwmrin1nqn207vmf-libiconv-1.15-x86_64-unknown-linux-musl/lib

The resulting closure is quite large and includes gcc and all Haskell libs. Total runtime closure size is 1.9 Gb!

Cache problems when building stack project

I'm trying to statically build the following project: https://gitlab.com/morley-framework/morley

Here is updated default.nix (cabalPackageName, compiler and pkgs are updated)

default.nix

# Run using:
#
#     $(nix-build --no-link -A fullBuildScript)
{
  stack2nix-output-path ? "custom-stack2nix-output.nix",
}:
let
  cabalPackageName = "morley";
  compiler = "ghc865"; # matching stack.yaml

  # Pin static-haskell-nix version.
  static-haskell-nix =
    if builtins.pathExists ../.in-static-haskell-nix
      then toString ../. # for the case that we're in static-haskell-nix itself, so that CI always builds the latest version.
      # Update this hash to use a different `static-haskell-nix` version:
      else fetchTarball https://github.com/nh2/static-haskell-nix/archive/c1a550481c475fb20d3858a1cbc446a99e0936ee.tar.gz;

  # Pin nixpkgs version
  # By default to the one `static-haskell-nix` provides, but you may also give
  # your own as long as it has the necessary patches, using e.g.
  #     pkgs = import (fetchTarball https://github.com/nh2/nixpkgs/archive/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123.tar.gz) {};
  # pkgs = import "${static-haskell-nix}/nixpkgs.nix";
  pkgs = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/2436c27541b.tar.gz) {};

  stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" {
    inherit pkgs;
    stack-project-dir = toString ./.; # where stack.yaml is
    hackageSnapshot = "2019-10-01T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions
  };

  static-stack2nix-builder = import "${static-haskell-nix}/static-stack2nix-builder/default.nix" {
    normalPkgs = pkgs;
    inherit cabalPackageName compiler stack2nix-output-path;
    # disableOptimization = true; # for compile speed
  };

  # Full invocation, including pinning `nix` version itself.
  fullBuildScript = pkgs.writeScript "stack2nix-and-build-script.sh" ''
    #!/usr/bin/env bash
    set -eu -o pipefail
    STACK2NIX_OUTPUT_PATH=$(${stack2nix-script})
    export NIX_PATH=nixpkgs=${pkgs.path}
    ${pkgs.nix}/bin/nix-build --no-link -A static_package --argstr stack2nix-output-path "$STACK2NIX_OUTPUT_PATH" "$@"
  '';

in
  {
    static_package = static-stack2nix-builder.static_package;
    inherit fullBuildScript;
    # For debugging:
    inherit stack2nix-script;
    inherit static-stack2nix-builder;
  }

It successfully builds stack2nix-build-script.sh.drv and stack2nix-and-build-script.sh.drv extracting binaries from the cache, but after that, it fails to fetch stuff from the cache and starts building everything from scratch.

part of the output

these derivations will be built:
  /nix/store/lchkz0yh34p43q71zc4hiqn10ywqx1d3-bootstrap-stage0-stdenv-linux.drv
  /nix/store/3w0hc7h8w3r5m3vsv7yip6hxsdanz11w-bootstrap-stage0-musl.drv
  /nix/store/dan4prhrgcjrdfdsdww4k5fdwf38a8rz-bootstrap-stage0-binutils-wrapper.drv
  /nix/store/1pggvq4nzipj49n8vdz7lw114m2i1hgx-bootstrap-stage1-gcc-wrapper.drv
  /nix/store/bbhahqrgfj4fgwhrpkizh7lbr5vpk7j0-bootstrap-stage1-stdenv-linux.drv
  /nix/store/c9k6vjrmqp4nb4ijjia2yj23k0g8007c-gnum4-1.4.18.drv
  /nix/store/dv1100zvihvzj2328f75wvxqw7xgq5m0-perl-5.30.0.drv
  /nix/store/0h7dx2a0br39bwndjyc6m2r2lrfdfpix-bison-3.4.1.drv
  /nix/store/yw7aw5d53fhjbzwvczwdw4gx30hxscsq-autoconf-2.69.drv
  /nix/store/m00s5brsi7fh9w3f4lxmr0d8n4n2m2mp-automake-1.15.drv
  /nix/store/xwzs0dz6p4fwh1mn0zs6llzlf5vpgdw9-xz-5.2.4.drv
  /nix/store/3hzqxim0w34j26xghyhldln227x8xwdb-gettext-0.19.8.1.drv
  /nix/store/bhmqajv5xfhh9fr7dy5dbxm81sfxxgwx-zlib-1.2.11.drv
  /nix/store/647djvm6gxdjw7q050rpvv9qmjvg0fpk-binutils-2.31.1.drv
  /nix/store/b3j8nd4hsap88di5wiw2yfx6wqc0hda1-bootstrap-stage1-stdenv-linux.drv
  /nix/store/mbck3k469fy90zf830zbaiwfrfim75dn-expand-response-params.drv
  /nix/store/2nw7wj4nrbm2isyvhcvimmnx6n4046rl-binutils-wrapper-2.31.1.drv
  /nix/store/y5n8d8j1ds0k5ryvsvr49rflszrn981l-bootstrap-stage2-gcc-wrapper.drv
  /nix/store/kqa8mf1x3b3yqa20p5lk8yw4p98n3ndn-bootstrap-stage2-stdenv-linux.drv
  /nix/store/22nq63n93bmnj48ldq833hyq14908x87-patchelf-0.9.drv
  /nix/store/9kdkbdfmssx0zlk238lmski3590d113s-bootstrap-stage2-stdenv-linux.drv
  /nix/store/mk4jmvlf86k68n4xf2s6sz9dfylp7rmh-gnu-config-2019-04-15.drv
  /nix/store/0w2gvhh62gi49ngy82njjr9s7bi700np-hook.drv
  /nix/store/f021qihl8hbhfpzmvxw5hh0mrlhkmid5-linux-headers-4.19.16.drv
  /nix/store/2nw34vhsz34rahssps1jsn5blr4n4dw7-musl-1.1.22.drv
  /nix/store/1q7k49phnb047vkmg3dbh6xijkk5j133-binutils-wrapper-2.31.1.drv
  /nix/store/pv6l3kg0wmhpi3bdfaxx5lgjhr3yhg2j-expand-response-params.drv
  /nix/store/qwb3g29m0qbd03nx35hywgjxfc9rjmzj-bootstrap-stage3-gcc-wrapper.drv
  /nix/store/a8yjjy3c18xvw5v5r5ir2gmi8w6pdr5k-bootstrap-stage3-stdenv-linux.drv
  /nix/store/8ks4wik7xxvxpmc6c2v0v19gcx2jp3dv-xz-5.2.4.drv
  /nix/store/5iswz7wqc1zfr71pdm68sdjrk5w10kq7-gnu-config-2019-04-15.drv
  /nix/store/lndrh43cra16z922hf7sdf59lnhmzgnp-bootstrap-stage3-stdenv-linux.drv
  /nix/store/8xmzbjwmxhvpiqs0rr0m4mrixxbxrym5-hook.drv
  /nix/store/zhki0dyffmiayh90d1vjafw6hr1rd1yv-gmp-6.1.2.drv
  /nix/store/7wkgfixrv0l54czbqxsc2b183633hx3n-isl-0.17.1.drv
  /nix/store/8g1vimh1kgx62rw8ihqwj4rv58d1n395-zlib-1.2.11.drv
  /nix/store/bw52q1b5z8qqb2apbk5kdqxm959cvanv-autoconf-2.69.drv
  /nix/store/vajxdsa942i81br95j54m043vfjnqpb1-automake-1.15.drv
  /nix/store/gmjmfa3yz1jvd0q6a78aic86lv8gz79c-gettext-0.19.8.1.drv
  /nix/store/ipspfggx2a163ljc96ydfgrm9wxwxkfb-mpfr-4.0.2.drv
  /nix/store/lzh3h0x9371rpc18nln3wgbgpzn8q7va-texinfo-6.5.drv
  /nix/store/mmhsdxkzgmgmcl84i4d9n0vinncl3nxm-libmpc-1.1.0.drv
  /nix/store/ysaxzj19maaw5fpv1v82cr6x5sxf3paz-which-2.21.drv
  /nix/store/zjr0b1wjz1mwhliyswx9idzqc10gm3m9-libelf-0.8.13.drv
  /nix/store/83jfy6p0zwb59b2j97243wmnzlwrkagv-gcc-8.3.0.drv
  /nix/store/c5nm4nbamcq0263i0i44629sgxcr0mzj-expand-response-params.drv
  /nix/store/fwy941cqigzqi2qkc3bg91n0qmfa9hza-bootstrap-stage4-gcc-wrapper-8.3.0.drv
  /nix/store/ymdfwxkr9qlnhq0y427l4404bydl5mmd-bootstrap-stage4-stdenv-linux.drv
  /nix/store/4xj8rm5d6fmpv0xj5s9rfnifnfmiv54m-xz-5.2.4.drv
  /nix/store/27g8a8wmy94f8fpmdig4gri6hd3awn7j-bootstrap-stage4-stdenv-linux.drv
  /nix/store/97cm5w8l6ddzzsi1xmizhq2yrki5nws5-autoconf-2.69.drv
  /nix/store/7wdgpwmkvmby5s2ia83xc18zimfshay4-perl-5.30.0.drv
  /nix/store/l1fmplnl1xmadim6hrm9c135dvhqhddy-perl5.30.0-gettext-1.07.drv
  /nix/store/aw4kl9b54zvf1n9l5wzfmlc6d5cwgaa2-help2man-1.47.11.drv
  /nix/store/fyxx0r07afsbzfj2s2lbcaxbgmh2wr1v-libtool-2.4.6.drv
  /nix/store/v1vi1iv8jh2qb6b1h5j5r2ak1chxxjqm-automake-1.16.1.drv
  /nix/store/263dghwnv2qjfwzdv4ncdic4nxc44qk7-hook.drv
  /nix/store/srjasfwc9dydxczysk94g1hz164abap1-attr-2.4.48.drv
  /nix/store/33y6b4vrn1gvy4paywz2089vm4jikgcv-acl-2.2.53.drv
  /nix/store/5cg4va57myxcx442blmg8ha96a9v8lk0-coreutils-8.31.drv
  /nix/store/2izh954p94cpsw0yn7br52h84x6l989y-diffutils-3.7.drv
  /nix/store/2qdy1asj32pm3cr6f0frb0nkdig93r71-gzip-1.10.drv
  /nix/store/60f4gkgz81ykci03s8a36avj2iavv5fx-gnused-4.7.drv
  /nix/store/8qcb4ppq5vlxkf0p15zwm1jnxjssd65b-gnutar-1.32.drv
  /nix/store/9yqnsprfqwqvfzfjx2400k0rjmk0fk0z-binutils-2.31.1.drv
  /nix/store/ijsmf9ilzabk6gnjx261b9sn31sfbl2h-bash-4.4-p23.drv
  /nix/store/w2y1danc24cz5if8nnmmr4hk847gd7d0-pcre-8.43.drv
  /nix/store/yvsy1rs7pbp0bjcpj1bdql1vcrymrdhb-musl-iconv-1.1.22.drv
  /nix/store/pb8z5q4yn0i4wlxgabjnmlvm5srvbxnd-gnugrep-3.3.drv
  /nix/store/lna4x080znqwvzqj3lx12r28l7nqjq88-binutils-wrapper-2.31.1.drv
  /nix/store/aj6iv862c0wivz4dcbkc9i5rwnq938wv-gcc-wrapper-8.3.0.drv
  /nix/store/c56l42w2iad4bf3c4xa6284g9gg5dip8-patch-2.7.6.drv
  /nix/store/d4d11xi52lw9nbsdl8gq56sjmx47lrhw-bzip2-1.0.6.0.1.drv
  /nix/store/yc0fdid9lkrh9jpbgrgw3xqq0h7vk5m3-gnu-config-2019-04-15.drv
  /nix/store/d7d4ql9xxjzsajw722z7500m27pirqv1-hook.drv
  /nix/store/hzw52bvz40czxlvhw6266m95qp24llg2-gnumake-4.2.1.drv
  /nix/store/jk53fbg76ikkwdq76y41hqmj1l6rah69-findutils-4.7.0.drv
  /nix/store/qmc3fs4jr6xf3zclaprrw1fsrkczg6n3-patchelf-0.9.drv
  /nix/store/vzijc3z49cnr1gqdqya26qvyqjy8zgmd-gawk-5.0.1.drv
  /nix/store/qm3gpwh51ysamdp3xzf8smm9hq0y063g-lzip-1.21.drv
  /nix/store/z9q9wzzz6qjkh6iiwxjj3jq6fznqyanx-ed-1.15.drv
  /nix/store/31g9l0h0gw7c56rdjg0bmj2s0s7ja5h7-stdenv-linux.drv
  /nix/store/3y4w21wj7891jlkfrkzldmn3nvj4bqy0-python-remove-bin-bytecode-hook.drv
  /nix/store/nkw0nx68qx6md2kl3i2w1cay7hrphydz-stdenv-linux.drv
  /nix/store/3nfy5hx2ydraz6765y5114yrd291xrn7-unzip-6.0.drv
  /nix/store/zv97fn4fj9cxc6vdibgappkk71kl16jz-ensure-newer-sources-hook.sh.drv
  /nix/store/47fr6phhssphjfchk9q47r54w5lf8q2j-hook.drv
  /nix/store/yra3yag7zcjrk4gqib061v3x3n3hpxcf-hook.drv
  /nix/store/xiqnr9ki42dfzdy2n05j9lq3n8cciqia-hook.drv
  /nix/store/0sy0iyx7m8pahd3f7qgdyf6sszskif39-xz-5.2.4.drv
  /nix/store/1fnfpm1sv80yf025s8mj7z1rrzn7hl1y-sqlite-3.28.0.drv
  /nix/store/znm4mng5y1a7cxymyy0f2s3kpg6161ad-pkg-config-0.29.2.drv
  /nix/store/hvms3azgffn3qq1jhcc3mf851skmd9vs-ncurses-6.1-20190112.drv
  /nix/store/cm0h8179hly5zm7pfm51rrv2hpvpkwy0-readline-6.3p08.drv
  /nix/store/5jdvjvwxhcsdwbxjmfx799vjlg0w5dxx-perl-5.30.0.drv
  /nix/store/qrqhbkrx40i5m91fj0ywn5iimm0lww5s-openssl-1.1.1c.drv
  /nix/store/vix659mm366jvigrmdkcs2l60wav857i-python-setup-hook.sh.drv
  /nix/store/x3p9yfr3rxipgrd0zlgs592dmvn4dd6r-nuke-references.drv
  /nix/store/x95xzfch2spd61v48x4zprk7gxx6w8vl-expat-2.2.7.drv
  /nix/store/ya6lc940ak7xjhnmh73ryqc2c7sbzlqd-gdbm-1.18.1.drv
  /nix/store/yaph0kj7dyijh0kp5iaz7sh0fl4xri9m-tcl-8.6.9.drv
  /nix/store/5qvfa3cp0pnp0xs35yv6f177s8a9hcp9-expect-5.45.4.drv
  /nix/store/35ffpvcs68vm7m0y1hj54pj2jcbzjbl2-dejagnu-1.6.2.drv
  /nix/store/ywn3ayjhyddypdnzf88ai4vi9s7mmbpr-libffi-3.2.1.drv
  /nix/store/zv14l45ylyvm99zml5c86pvplnbz7ycd-python3-3.7.4.drv
  /nix/store/kff2557p2jwzxdgh8xsl8pmdvg7x3ycy-hook.drv
  /nix/store/mcsc6avkp08gv8f6dxj6zd5qlp841fmg-setuptools-setup-hook.drv
  /nix/store/wj6mqrmyly22b5gvxw5qmzpfc4hslvdp-pip-install-hook.drv
  /nix/store/yva8qljj7yp3kfw5dlal8bmvwmc2f9yi-python3.7-bootstrapped-pip-19.2.3.drv
  /nix/store/yvm2x4vpnswwzg9rj66z8767l7rl1r9z-python-imports-check-hook.sh.drv
  /nix/store/vk0ncc94i8f0g7p1paaxkxka77i7sd8z-python3.7-setuptools-41.2.0.drv
  /nix/store/3z0syl1n0252rd7vg3akswin47a88yqc-python-catch-conflicts-hook.drv
  /nix/store/4rz3cmgrl5wyr5iwcph8wmdy6rk8flix-python3.7-pip-19.2.3.drv
  /nix/store/ksdsxppahmsdjyvscs1xzfbqivz75md3-pip-install-hook.drv
  /nix/store/fipaa15ancrkf82wal3zxzngmypbkx04-python3.7-wheel-0.33.6.drv
  /nix/store/y949chnnq8ddvigxpwah6zjlhjszfsv2-setuptools-setup-hook.drv
  /nix/store/042iy6yir5y8kjgywi1ybm4vk769vvsk-python3.7-atomicwrites-1.3.0.drv
  /nix/store/avwq1njks5bik7ysgq5plnjx6bgxffnd-python3.7-six-1.12.0.drv
  /nix/store/l5x4g9nz5g7fdzpj24hzzdh8faqpmink-setuptools-check-hook.drv
  /nix/store/kfz042inb3y9dqj07xl60p8sqaqm3dki-python3.7-setuptools_scm-3.3.3.drv
  /nix/store/045y7zn4ry9nlvms78zbxl8rbglpf5sy-python3.7-python-dateutil-2.8.0.drv
  /nix/store/anrv3mjlkn6w8lpiry89izs58b9qlc56-remove-references-to.drv
  /nix/store/grcqpcf41pma4b34a4pamrc0hhy9gvmp-gnum4-1.4.18.drv
  /nix/store/b37ha3avdh1ci6hk4jr1ggakhmkfrv1l-autoconf-2.69.drv
  /nix/store/7ncgnq69fz2qgllw628afsaqyh72m345-automake-1.16.1.drv
  /nix/store/0i5flznzp5hvlh9dssqv6a14vpiim249-ncurses-6.1-20190112-abi5-compat.drv
  /nix/store/1khdp7da2mwyyfalwhmq3dl8wg3mia84-bison-3.4.1.drv
  /nix/store/6bwcr42k4pw9qwrkf0l60x12xj8d4yli-linux-headers-4.19.16.drv
  /nix/store/6jfyslgq5ls2sjfimc998594g3b61lwq-glibc-2.27.drv
  /nix/store/94gz3h8h0464jv45wagskhqa7ahy5b9l-gmp-6.1.2.drv
  /nix/store/n78x0j3fy11x5k6vsc9r872g4cgn31n8-ghc-8.2.2-binary.drv
  /nix/store/ih34xxfqc2fbx37sjr5c71shbdc3c5nx-hscolour-1.24.4.drv
  /nix/store/n4hdz736kr8v2s83jnrwman0frm8wdhj-mtl-2.2.2.drv
  /nix/store/7ysw6xc75c552sgfqkq3b6zv4jvs2qcq-happy-1.19.12.drv
  /nix/store/85qj157b7xr19iqp8kjzc4jk1fx6y41k-alex-3.2.4.drv
  /nix/store/p9k6hf0bg43yp35bnr2mm3110xfkpks9-python3.7-pyparsing-2.3.1.drv
  /nix/store/48dhg1w1mv6lhmc137xc66cfyi5y5nbk-python3.7-packaging-19.0.drv
  /nix/store/6j327iyy80mbdbz3w5cqdx39wsdhx1kl-python3.7-cryptography_vectors-2.7.drv
  /nix/store/s35cjcyfbgs433y1da74y2bmqb0dflxg-python3.7-pbr-5.1.3.drv
  /nix/store/9d107sqckjc1ar8q7assnhxrhkvigs4p-python3.7-linecache2-1.0.0.drv
  /nix/store/0d152yy3vnj59ldw5v2yqkfzgji9xg5y-python3.7-traceback2-1.4.0.drv
  /nix/store/mpyvpqgh0gfzf793jg6cil8wwvr6fxa8-python3.7-unittest2-1.1.0.drv
  /nix/store/x5cd5ylwfvixq6bb7fwmmid56b3cx0ap-python3.7-funcsigs-1.0.2.drv
  /nix/store/0g4wi0y15lpz69w2472cjcnhqi5f5qz7-python3.7-mock-2.0.0.drv
  /nix/store/0rz3p45p56r5bq4dfqlf2qjngjh4if1b-python3.7-py-1.8.0.drv
  /nix/store/8pflh3g2qzv73vklhpw2n6y6pc243k7a-python3.7-coverage-4.5.3.drv
  /nix/store/p30gg5ckw49nrmckjx0hr55dw5d6v5ya-python3.7-nose-1.3.7.drv
  /nix/store/81b7mwcimjy9h35skq3g894xgf2j2w4j-python3.7-more-itertools-6.0.0.drv
  /nix/store/rfbqhh29l1q39yfdgy5qlsv480bscmq3-python3.7-attrs-18.2.0.drv
  /nix/store/b65jv29p902r42jw1p3fv07xl42bq1wv-python3.7-hypothesis-4.7.3.drv
  /nix/store/l0f7q6m9yygcynh0kkxnd9wccga068cb-python3.7-zipp-0.5.1.drv
  /nix/store/jxw1y6wrl9jjzk1m6q6g212zfq8gy4bv-python3.7-importlib-metadata-0.18.drv
  /nix/store/fi4qxxdbi31j4cgmq02rban0xglwaiwp-python3.7-pluggy-0.12.0.drv
  /nix/store/lh7klp4x4m3xl5cvq5h7ss3y3hnn2w25-pytest-hook.drv
  /nix/store/sby6ys32w3f6vh26h2wcpy23997wmj2c-python3.7-wcwidth-0.1.7.drv
  /nix/store/a4g1kcsl3n33vdkpfwlbxz1gcrppdcfc-python3.7-pytest-5.1.0.drv
  /nix/store/8nkzx77w8vsz4jyiidhis6j5zkfs467p-python3.7-iso8601-0.1.12.drv
  /nix/store/df8p9ycjzsx5gyxadihjp87frkimjnr2-python3.7-pretend-1.0.9.drv
  /nix/store/vzanl60955l5ds2i8dnghx21x49yza4d-python3.7-pycparser-2.19.drv
  /nix/store/k4ifmpzr74dr5sx5b08mc57xw2ndr5qs-python3.7-cffi-1.12.3.drv
  /nix/store/kk2lkv8834c137bcr8wyg2lg0ilk8z63-python3.7-pytz-2019.1.drv
  /nix/store/ljngq8pjlribwsndrilqrf284qimp9x3-python3.7-asn1crypto-0.24.0.drv
  /nix/store/875i0dqrxniq98q4bv89dll5ddf8sbpf-python3.7-flaky-3.5.3.drv
  /nix/store/397asi4chbm5pvj90fzpkmzkp4f5livm-python3.7-apipkg-1.5.drv
  /nix/store/1wbs8vkivp4qingi53lfyfq5jkpzwjbi-python3.7-execnet-1.7.0.drv
  /nix/store/inrx8pz1pnqls4qzw5cm2i569ikkhk9w-python3.7-pytest-forked-1.0.2.drv
  /nix/store/i8d6mb74sicywlibrsx6w2n35nf0yiy0-python3.7-pytest-xdist-1.28.0.drv
  /nix/store/x5s40m5a29iahc0a9xfj9pyr4wh57zzv-python3.7-hypothesis-4.7.3.drv
  /nix/store/5hxvfw33lgj567bx6j9gfxncni342n6l-python3.7-cryptography-2.7.drv
  /nix/store/b72zwimrk3h0d5d38wmvy4078kdd46ql-python3.7-idna-2.8.drv
  /nix/store/jz4yh83fn3crkxf5s6rpy18i00pjzjhb-python3.7-pyasn1-0.4.5.drv
  /nix/store/4l86qaqrmzq0qmrw26hixq9d8f3ngc3v-python3.7-pyOpenSSL-19.0.0.drv
  /nix/store/wymwr2y5d1l9ng0gy58yrxa39chs7x4i-python3.7-pysocks-1.7.0.drv
  /nix/store/xglh79val05i4f02k3c115bl5r20hqmm-python3.7-certifi-2019.6.16.drv
  /nix/store/0lzgfdqsgk3xs3bp8g4slqccsnrsa4cz-python3.7-urllib3-1.24.3.drv
  /nix/store/yiivyi8bpajlxa2acbnf4di2icfbnsqn-python3.7-pytest-runner-4.2.drv
  /nix/store/gxpmjp7p9wwl0qxbqs36qsjxaz160p4k-python3.7-chardet-3.0.4.drv
  /nix/store/06dzngbr14aah94ifk42w41r3j9y4sik-python3.7-requests-2.22.0.drv
  /nix/store/kk6av89rjbrr0j8wl1z6bx80rf16v47l-python3.7-u-msgpack-python-2.5.1.drv
  /nix/store/2anx58myll34x2k28kjrm2kvzv0106gq-python3.7-pytest-expect-1.1.0.drv
  /nix/store/a3fid7x4q5042s42ghp900mn02bv7qcm-python3.7-webencodings-0.5.1.drv
  /nix/store/4md5hvx401gzmrk0bcdbdvm8w5ivv9yf-python3.7-pycodestyle-2.5.0.drv
  /nix/store/90xynm8srx4jkp0nl1kjn2rghzn8syi1-python3.7-entrypoints-0.3.drv
  /nix/store/xdbsvkslaw1np3y1py1m2z7gz0n631lx-python3.7-mccabe-0.6.1.drv
  /nix/store/xk0pkriy9ny54g7s0p0ga9sjn8id3s72-python3.7-pyflakes-2.1.1.drv
  /nix/store/pqm83wx44j7l15rgs5cvhyv19v9h0sf3-python3.7-flake8-3.7.7.drv
  /nix/store/09gc7wdpy00cmyc462sn2rxbfr088g2m-python3.7-html5lib-1.0.1.drv
  /nix/store/1h9pl2xl2k039a3fc1gwhcr4vainsvz6-python3.7-simplejson-3.16.1.drv
  /nix/store/8hm75rl54ppyasznm2j7zh1pdwhf1r9m-python3.7-pkgconfig-1.4.0.drv
  /nix/store/nmpxsy0hr14ay8b3w106bfq8jjkn2sjj-texinfo-6.5.drv
  /nix/store/r5ncsablprgj30sj3qfik3q1yq1ff6kr-mpfr-4.0.2.drv
  /nix/store/xcfwp1iymmk9i5ckil7hzqkbyyc0bkdg-hook.drv
  /nix/store/ls99y7xahy8gyfqmnzfk8zmjxqxqh226-gdb-8.3.drv
  /nix/store/3w2gfdh4yh9ss4qxndmfhw5wjrygb8z2-python3.7-Cython-0.29.13.drv
  /nix/store/f657fn5gd5hiancmyz017dxz2v079pb4-python3.7-PyStemmer-1.3.0.drv
  /nix/store/3l3ym2rl8cqpyc9v18djhh3l2v8003hk-python3.7-snowballstemmer-1.2.1.drv
  /nix/store/3nha5c5c69j2fs275nqgr9vdaxpzlali-python3.7-Whoosh-2.7.4.drv
  /nix/store/apjasmmjhz5yhhd7jsln50rrnrlm4clc-python3.7-docutils-0.14.drv
  /nix/store/45vf8zmhkaszjsncgrksbavzq3hhyhzj-python3.7-Pygments-2.4.2.drv
  /nix/store/wmjzsv2hhvpvmh3k9jxa380xiillgpa7-python3.7-MarkupSafe-1.1.1.drv
  /nix/store/4y5hzyl32r052cjsdkyhl66kyh9zpbag-python3.7-Jinja2-2.10.1.drv
  /nix/store/820vqbmj0rij0byk1syv7fqzvc08a1nn-python3.7-SQLAlchemy-1.3.6.drv
  /nix/store/hn3yp8wvshw4x8inp4ivfp5ldfychkfd-python3.7-alabaster-0.7.12.drv
  /nix/store/izandlkwm3d8y7ayns777g8rgdrh6655-python3.7-imagesize-1.1.0.drv
  /nix/store/mh5saiqq5m6nkp0k8a98zp2krnydzq4s-python3.7-sphinxcontrib-websupport-1.1.2.drv
  /nix/store/xzd250rjdx53pa8qla3fac8fsix5wcv9-python3.7-freezegun-0.3.12.drv
  /nix/store/w7mpsbw8cr4qbhyli5r66w9gn5zgmz6v-python3.7-Babel-2.6.0.drv
  /nix/store/j5g1ndkf238xsnx551cvwzw7q53pnvxh-python3.7-sphinx-1.8.3.drv
  /nix/store/l8kqghjx7akcgvpjzi7qj8l9fx3wa8gh-musl-iconv-1.1.22.drv
  /nix/store/yfq973irg28jdcw5hp7rv1w607d6w11c-hscolour-1.24.4.drv
  /nix/store/ydl4cpacrm7hhabqcvhwmh2sna7ysz3q-ghc-8.6.5.drv
  /nix/store/zbp38ghqwkx950fmpxwry29pjxm3g3ky-hscolour-1.24.4.drv
  /nix/store/05a4gczz3inw6rhd4z8n0jgvw93z0pxr-microlens-0.4.10.drv
  /nix/store/499r1hz7by8zdfrmavhci48mahj71ciq-primes-0.2.1.0.drv
  /nix/store/jkqxlf2186vy0ylhbxpsy78jlmpmr3yw-primitive-0.6.4.0.drv
  /nix/store/ays5vw8c1gja5ldq6rf978cgqa07vcps-vector-0.12.0.3.drv
  /nix/store/q0ih0jb994ahzsnq5si89gbsrkda41nw-text-1.2.3.1.drv
  /nix/store/0bnw6xki84lssf17gmwabhvwmj8hdvg9-monoid-subclasses-0.4.6.1.drv
  /nix/store/0fymkr81kcay3d7s6hrc1hs5r0gzy8fc-show-type-0.1.1.drv
  /nix/store/0k67npfd7jgnxyszls4bibzw6wgy3f35-first-class-families-0.3.0.1.drv
  /nix/store/g3isbw2i0qqmj56q1kb584a31r39647j-call-stack-0.1.0.drv
  /nix/store/0lpp18vs55l017a7v8w8jbw1f5blgqmf-HUnit-1.6.0.0.drv
  /nix/store/fgajlpg8gm5x38ghjqvnbk8jwjkawj2q-integer-logarithms-1.0.3.drv
  /nix/store/lvny4rqi0mn1scbng5s494yhflfnrqrf-hashable-1.2.7.0.drv
  /nix/store/npa4v8323b21w6s3wl9bzml677ndy815-scientific-0.3.6.2.drv
  /nix/store/0r5300lwmbhkqlmw1brxwdpl0mvmnx7l-attoparsec-0.13.2.2.drv
  /nix/store/0ycd5v273jb83fsi6nndv3in74knj219-unordered-containers-0.2.9.0.drv
  /nix/store/191sx7xp3n88xdld27pj8s2kwb1ygvxm-mtl-2.2.2.drv
  /nix/store/19vj2wjvz8z5pk4fhzvghv64kzkmz1wb-wcwidth-0.0.2.drv
  /nix/store/2vxlp7md5d1s8dc64fp6yyx43qm05prv-base-orphans-0.8.1.drv
  /nix/store/2xpj2d8jqv44234b6vlvd79488y81fgq-th-abstraction-0.2.11.0.drv
  /nix/store/94rfxkgvafg92j3c6lg0cykv64b5wv57-tagged-0.8.6.drv
  /nix/store/96m25wjsy2f9vg5vdgq17sfqvhdkf98j-transformers-compat-0.6.5.drv
  /nix/store/22di0x2bbrl2z31w0vvw7z6nq0infgvx-parsec-3.1.13.0.drv
  /nix/store/n4xwrn8hp4r8h799v07mi5ckblqh4j6d-patchutils-0.3.4.drv
  /nix/store/kxhwz4n0avldz6vlgcid1a29bw2wh506-5451.patch-Cabal-only.drv
  /nix/store/zj6fayffwwa3scf8lilhj5qcm1yabybb-5446.patch-Cabal-only.drv
  /nix/store/lrwbw133dvzqdgm6himw2g5clz4zlmbc-Cabal-2.4.1.0.drv
  /nix/store/rr0dkqpg5gbk20kgjfs3v2n5sfp8v8as-cabal-doctest-1.0.6.drv
  /nix/store/w6d1zz0sn7a3cw6y74vpw3w0bxgzg0p7-distributive-0.6.drv
  /nix/store/achdk07vph48yyay7qhz0zk4n5qhypg2-comonad-5.0.5.drv
  /nix/store/8vzk3bchkdrwqy5jz56bkil08r8mcjrh-bifunctors-5.5.4.drv
  /nix/store/5gp89n218za9wcr5ad5nz6536xdrwcsn-stm-2.5.0.0.drv
  /nix/store/7y7ghd1wp0bcr2gqiw2rnisn6pcdpmr0-StateVar-1.1.1.1.drv
  /nix/store/xdmpsbydb9b5d2z67wkclpmznp37r01r-contravariant-1.5.1.drv
  /nix/store/3xan17mjzd29kkh4b8mw0ds11vywzxhy-semigroupoids-5.3.2.drv
  /nix/store/lp0987qyf4xfi05ai39pb7hp85p0iki1-semigroups-0.18.5.drv
  /nix/store/45409q292g2dfw0lp7siqpm02vrmhpbs-profunctors-5.3.drv
  /nix/store/i8kv5hhnl527pf406cd76qqlcla4g9q2-void-0.7.3.drv
  /nix/store/80h7wc1hxqgazwfnvw1df229fz98dqnb-exceptions-0.10.2.drv
  /nix/store/dvg6a574shv38zfb1dv9vpb5lvrzmf6h-transformers-base-0.4.5.2.drv
  /nix/store/vghyz1src4pnk4cknzx5pfzh4qg0dmbk-free-5.1.1.drv
  /nix/store/1g5ccqfnfisccbw7n0acp6lzwfhq9m1h-adjunctions-4.4.drv
  /nix/store/as5fk2f6sw7cn4qcjccl7s4fnzjhlpwh-syb-0.7.drv
  /nix/store/c5m12agmql1anx7na61gmnbs5x33wwq2-th-expand-syns-0.4.4.0.drv
  /nix/store/kdbq4k372rh25ip0gb8zgzv32n51nms9-safe-0.3.17.drv
  /nix/store/lmx7w441zwhirq6hnlmrkgxbn5kdnjdk-th-reify-many-0.1.9.drv
  /nix/store/aq6sabnk32wi8v7cdpnjckjz4rrnsivl-mirrors-list.drv
  /nix/store/r5nw0mp5ms1m0is9s4pk43jqzfda2sb2-perl-5.30.0.drv
  /nix/store/q4iwf7nfh6i9c49g3xh1v0r1gf7x9r2l-coreutils-8.31.drv
  /nix/store/wipjndlh9zayjnnb1vca30cadj14nsr5-openssl-1.1.1c.drv
  /nix/store/jxqa023nag37xlws66kci9l6a2jl4i8h-libssh2-1.9.0.drv
  /nix/store/6csvqgsds8z8z0z7k3a34zxd3rbhvqw6-c-ares-1.15.0.drv
  /nix/store/i3zd3y4jdycbj97hw35r7lsa95a9ca3i-libev-4.27.drv
  /nix/store/z9rbjs2l17kbrl1xkmwyjz18pxvdaqcd-pkg-config-0.29.2.drv
  /nix/store/z0rbh77h79if61mmf09gklbz6sz96811-nghttp2-1.39.2.drv
  /nix/store/lhg3c7dnd4zmqa4dpbc1nn26qsxx518f-curl-7.65.3.drv
  /nix/store/qsmcnz3sz1j9x4pb3dgxk76j59n0ddzn-th-lift-instances-0.1.12-r1.cabal.drv
  /nix/store/n3287gwwivf40nr1rnjlnsa8h4ng1wdl-th-lift-instances-0.1.12.drv
  /nix/store/rxy2qvbvazlk534qh56bpjssxcjgwhm0-th-lift-0.7.11.drv
  /nix/store/jgcz8hrprdxh9vis6gsm523r79lhag6x-th-orphans-0.13.7.drv
  /nix/store/1h296ymnz7sx79s0p630m4pw24wmxzsp-th-desugar-1.9.drv
  /nix/store/1i6nzr679kjdzkkh8m8k9jbjxczbxyjb-async-2.2.1.drv
  /nix/store/58jgl2ks79g89pjgcbljg2w4i20r0cwb-base-compat-0.10.5.drv
  /nix/store/5dc2fkvks6038dih6plkk3cw6padw6gy-random-1.1.drv
  /nix/store/d92dadz7qbwx48k9qvc4xbdr7c1vwvzl-uuid-types-1.0.3.drv
  /nix/store/k5147fsnc3m13hwrcjaz5c0pi3bi2bvx-time-locale-compat-0.1.1.5.drv
  /nix/store/mfiixpkfxb4n08xsi59cssldrnhfr2km-dlist-0.8.0.6.drv
  /nix/store/1j0n9pghcj37ihsyqxa1bkw6gy9r7fv9-aeson-1.4.2.0.drv
  /nix/store/m54m7sv05n8dbwaza69gpvaf8lg3q6kh-unliftio-core-0.1.2.0.drv
  /nix/store/irdy9v9zzpj7d9hcih2zw85nacgrcq8z-resourcet-1.2.2.drv
  /nix/store/w415r1rsjcl6ci6hi7jbhyx08dilwg71-split-0.2.3.3.drv
  /nix/store/wa8xf82l1ia56lidzixpx5hd50m6a4kx-vector-algorithms-0.8.0.1.drv
  /nix/store/mwhx26zc0sh9aifkyx1w1jb4i1dhv0dc-mono-traversable-1.0.11.0.drv
  /nix/store/7qv2ai7jf2xbfmb848achdv0x0lgxnz7-conduit-1.3.1.1.drv
  /nix/store/xpbn3pm0009jqyki4d8xjag6abyn0v6d-libyaml-0.1.1.0.drv
  /nix/store/zj01m589mvgphss4j2h4aalvwd6w36nz-yaml-0.11.0.0-r1.cabal.drv
  /nix/store/1iijnc8m19icprcxfzakyj1zgv0vipmm-yaml-0.11.0.0.drv
  /nix/store/237mbdcygbi0g40s4n50lb3phjmkzla4-base-noprelude-4.12.0.0.drv
  /nix/store/4h5ndskv7bscdzk3rdk0n3rfzxx3hr54-data-default-class-0.1.2.0.drv
  /nix/store/62q1639qvggh94ksnmcdzycx0lfyq0w7-network-2.8.0.1.drv
  /nix/store/6y38m6swi9kaqgmqifr12m9qhnc0a8sz-network-uri-2.6.1.0.drv
  /nix/store/nri50zd0lflqrrww0lamszajsdmngd9s-basement-0.0.10.drv
  /nix/store/j4vbazp1jvi9v7z30l4bg80l0frqr083-memory-0.14.18.drv
  /nix/store/h0p8mwwdfsn3khr47ywm09xlgm1my96n-cryptonite-0.25.drv
  /nix/store/mfylx8by4qmn2cid4cra7djiprdr3nbq-hourglass-0.2.12.drv
  /nix/store/ls89vzwlq631af29rjn95cb3z568nrnr-asn1-types-0.3.2.drv
  /nix/store/njy5xdd0wb776hlywvk9d9niqxhf7ksh-asn1-encoding-0.9.5.drv
  /nix/store/pwl2p2ibg4y0az0wxvlf6agipd3yg1m7-pem-0.2.4.drv
  /nix/store/y30fav2sab0zyxcg3nb020d1rxvy3xqk-asn1-parse-0.9.4.drv
  /nix/store/qllcdr7jai7szh5bqvidi5n07qzj0337-x509-1.7.5.drv
  /nix/store/1ppq2nxrw1c5srz9qpkbz9hhyrgqxzc1-x509-store-1.6.7.drv
  /nix/store/iipcyc20fgpay60d8sp2m1djlyz5xvcx-cereal-0.5.8.0-r1.cabal.drv
  /nix/store/cf8r76lb2ynm2gr3cm77y6ycr5l8ghsn-cereal-0.5.8.0.drv
  /nix/store/p1xqjni80mzbbd5pmrm0hf0giaqkhkrs-x509-validation-1.6.11.drv
  /nix/store/ima3hz3xfipbnfc5ak1nns5na2fhywfr-tls-1.4.1.drv
  /nix/store/iilnwgpcy36mr6dp6jmlkigv6w5xywfn-mime-types-0.1.0.9.drv
  /nix/store/ipb4jkk5aa392dsv70rp9mwz7914i84r-cookie-0.4.4.drv
  /nix/store/q0rlwz8iic55zgc56pra22hkcv5jhmyh-blaze-builder-0.4.1.0.drv
  /nix/store/q21f4q7qsmk36184z9yd5v9dih5k2r22-case-insensitive-1.2.0.11.drv
  /nix/store/ys1rwvfvfn2jf146p6p90gnwx2jq9xyv-http-types-0.12.3.drv
  /nix/store/hwzrycjynb6wa3hcjghdqcqafyi6x0db-zlib-0.6.2-r1.cabal.drv
  /nix/store/kssjnfxz3qxxafz54ppmp9wb3yjwlign-zlib-1.2.11.drv
  /nix/store/lrk24d6y73j4jbq048nvy98x0a491xhz-zlib-0.6.2.drv
  /nix/store/yz42xc7x2vaq3xx1w6s9g6gma22gpwg9-streaming-commons-0.2.1.0.drv
  /nix/store/nfxi0nh0ryk64f7lz0n8afikc79gc9nw-http-client-0.5.14.drv
  /nix/store/kfc0kf0sq333xskh7r8wjw5k1qxqmx4q-x509-system-1.6.6.drv
  /nix/store/y4bmr8aaa08k6rrigigg49w67f67ndg0-byteable-0.1.1.drv
  /nix/store/bv1zwjj11mfr3f9rnbf661jixj54rzwi-socks-0.5.6-r2.cabal.drv
  /nix/store/y640lxlci97y00lygpvamxy7342r46pp-socks-0.5.6.drv
  /nix/store/y4h1fpssval5k0j7lfs4rd7xjd031jra-connection-0.2.8.drv
  /nix/store/g3yik9zhaa7qcdiwhl2yifmqji8nz7h6-http-client-tls-0.3.5.3.drv
  /nix/store/j3rs1l8sh7s5j1vkc9k4blxs42lwp898-Glob-0.9.3.drv
  /nix/store/6cmswa0ayr12627vzi7aqzvz5128lk9d-text-metrics-0.3.0.drv
  /nix/store/zcgr0gj1pd693pnrz73r92pnkyn47hdp-infer-license-0.2.0.drv
  /nix/store/kg0n2lcdcc0mjigs8wxkkc5mzqx5hsm6-hpack-0.31.2.drv
  /nix/store/aqagc4z6n2vdw0lj5djz9l61i62kwhrl-microlens-mtl-0.1.11.1.drv
  /nix/store/hqr6vkkihr3wmlzrs26xgll21xnlbpg2-utf8-string-1.0.1.1.drv
  /nix/store/psgi859gr6qb8z0i12mcyjv6hv7syxf9-safe-exceptions-0.1.7.0.drv
  /nix/store/lyxvszpsdz1nyqgrp81kin1kr5wii1b5-universum-1.5.0.drv
  /nix/store/1jf0kcim9fbzvc5dvdghpiz5mqgh9v8a-morley-prelude-0.2.0.1.drv
  /nix/store/690vwi11gbpq0in223bfa0kk2qmb21j3-hspec-expectations-0.8.2.drv
  /nix/store/490cnmpbl1nd9p3aqazp7hdgr76c5vkw-setenv-0.1.1.3.drv
  /nix/store/rxzklxpcdjgm0kw52z5iipn1shrq3dp3-tf-random-0.5.drv
  /nix/store/wrrgmvplkwvyhblv2anjdl5n20w6s2xn-erf-2.0.0.0.drv
  /nix/store/f825nxz2zqazh7y7l9qsrnwgldrraj77-QuickCheck-2.12.6.1.drv
  /nix/store/mbdb11lhdrh4fxsq5cfx7503vk2w3p4n-quickcheck-io-0.2.0.drv
  /nix/store/vnm72cv6cg38haz5apa0mjx4ahf2igzm-clock-0.7.2.drv
  /nix/store/dss802s6r8sxq25rd97zp4ydcm0ck9rh-colour-2.3.5.drv
  /nix/store/xdfkb38qngp2s04qdsqayb2npdi0dl89-ansi-terminal-0.8.2.drv
  /nix/store/73fbi3pakcq5kjlmhplv63gkjm7xjw9m-hspec-core-2.6.1.drv
  /nix/store/bj5bqzga1gydf3r1ml07x3m4zcxfzds1-hspec-discover-2.6.1.drv
  /nix/store/2hyp6q3b8mvzv6qn8dqya780jc2hymg5-hspec-2.6.1.drv
  /nix/store/3i31w58yxcxf4cs8m6mxpzx5apfgy00g-happy-1.19.10.drv
  /nix/store/3nvb94z7rf99y8sfwgn5n3chylz1xqlp-base16-bytestring-0.1.1.6.drv
  /nix/store/3p04vj6qppq0kd7qq3ql0gia6s8gcjxz-singletons-2.5.1.drv
  /nix/store/8zaasg8crm3k3z9h24phscdgir5fvghq-old-locale-1.0.0.7.drv
  /nix/store/pzsmz360kamlyq1cs0x80bmc79wbn6vi-formatting-6.3.7.drv
  /nix/store/xxz5m9gn3rdpqndnsiz8pab0zqib3lzk-base64-bytestring-1.0.0.2.drv
  /nix/store/466swp8a0kbl8zsp6nhh3hr50n6yz50w-fmt-0.6.1.1.drv
  /nix/store/4kygsf3g9kcm34q2synih7g3b5i1f20p-timerep-2.0.0.2.drv
  /nix/store/5zxam348mhv635wr47k2wscrmx95pr27-hscolour-1.24.4.drv
  /nix/store/6648yxi9mf8q2j8qax6yqdz86m2w5rzh-ansi-wl-pprint-0.6.8.2.drv
  /nix/store/7lhr92hr2vmlhd2w93rhzisfmvjxl68k-cmdargs-0.10.20.drv
  /nix/store/7qf01gxxxiw39mzcjislh31kzbidwif6-constraints-0.10.1.drv
  /nix/store/7xzby86s90z6b9i1wpjvwqp4bbi4sybd-generic-deriving-1.12.4.drv
  /nix/store/86vq3df2mh7i561iar0cqm02yzhp4aqf-pretty-simple-2.2.0.1.drv
  /nix/store/a0fxk7wmxwha84wjshs5zld8mlysbs7k-reflection-2.1.4.drv
  /nix/store/asjvd580ba3zwq1fnlal7rwl9ym8x7df-named-0.2.0.0.drv
  /nix/store/vkl9867z3y4zngb1ma7l0cygwdzdbqxf-haskell-src-exts-1.20.3-r1.cabal.drv
  /nix/store/b8by32na428f4yzbpqiamkwpg6nspaqc-haskell-src-exts-1.20.3.drv
  /nix/store/gsrrnwf8w0shyvglnyn8ivbhwwnyc60n-optparse-applicative-0.14.3.0.drv
  /nix/store/jbnj4xas1ra1skfcdk7vx54rfzqyf11f-unbounded-delays-0.1.1.0.drv
  /nix/store/qgn3f62gyjl8ym1v1wazph7p57vw9ia1-tasty-1.2.drv
  /nix/store/c3hkp6wc8h3jkkrdd0cgh4mai71pcxpq-tasty-hunit-0.10.0.1.drv
  /nix/store/sj02sgk6hcq7hw2m71xqqz2dkj88aa7g-parser-combinators-1.0.3.drv
  /nix/store/fxbi79mc9gsqj6wxd18bk01fwva34yiw-megaparsec-7.0.5.drv
  /nix/store/fyvs7fk16v0dykw6d3zp25aqfidi16nk-parallel-3.2.2.0.drv
  /nix/store/mf92761sgmq8ampw06r84r73gn092vmr-invariant-0.5.3.drv
  /nix/store/kajqd7cp34mvjbpq9il00hp99s315f80-kan-extensions-5.2.drv
  /nix/store/fym2ind343npbh5vnhn1dx1ry9iz5qpj-lens-4.17.1.drv
  /nix/store/h3w2ywgwvhpqa1klqdba6n5zy22d98ck-aeson-options-0.1.0.drv
  /nix/store/hp9cb8kz2sy8dlmq08hlx33ahi33gpz8-ncurses-6.1-20190112.drv
  /nix/store/n6dh8zzmr7h7fbgkw2wgq64zsqpxjg3b-xml-1.3.14.drv
  /nix/store/k5d56jsivp981h96713w8hffxsjhndgj-tasty-ant-xml-1.1.6.drv
  /nix/store/sgl5rxrri4xqcnnw4247xwq2pa1344hq-haskell-src-meta-0.8.2.drv
  /nix/store/khbplqlkyl7y2fvcv54fj6ggl3b9y589-qm-interpolated-string-0.3.0.0.drv
  /nix/store/ndc9hg0m9asqglnjfr82xnfxa02lz826-base58-bytestring-0.1.0.drv
  /nix/store/pxyqmia4ss5ml4309fpxb3a78z3a3q9y-Cabal-2.4.1.0.drv
  /nix/store/w10hyv0gz7ldnxkqj2vjibd39pkbmqzv-data-default-instances-old-locale-0.0.1.drv
  /nix/store/w9pgzrhh81y0wdxy2gbbjsdqq14jnwwj-data-default-instances-dlist-0.0.1.drv
  /nix/store/yblb5kkhg01pzmp5jaddz4p3nbkcb2li-data-default-instances-containers-0.0.1.drv
  /nix/store/q75r2whfqwngaqbv8vwsnhzq4r2ay586-data-default-0.7.1.1.drv
  /nix/store/ri569v7lbdj6pj5yn93421r5q4jqsik0-quickcheck-arbitrary-adt-0.3.1.0.drv
  /nix/store/s1vd9lhkxip1qb75agfxm42gk0a0xxjg-vinyl-0.10.0.1.drv
  /nix/store/s3p7n3cr5ancg5dmnlvmbml9xcbgm1n3-aeson-pretty-0.8.7.drv
  /nix/store/xf40v222jxkcqhliba5sqrfynlgrrykm-wl-pprint-text-1.2.0.0.drv
  /nix/store/xqcnczarsmzk30fwgglxvd0jwf0fgs0m-hex-text-0.1.0.0.drv
  /nix/store/qc790m6cpnl4q0kjngcs1vrdkdddk813-old-time-1.1.0.3.drv
  /nix/store/ywa56wgw4qm4zrrr896f93hp46f7nbz3-quickcheck-instances-0.3.19.drv
  /nix/store/hxxzpgkhh7rjq1hacwa89f67bqnh52fs-morley-0.3.0.1.drv

Apparently, somewhere something is wrong with NIX_PATH=nixpkgs, but I can't understand what exactly

Building all Stackage executables

I plan to build as many executables from Stackage as possible, statically.

This is to

  • demonstrate that this approach of static linking works well for many packages in practice
  • find out which executables have problems and where we have to override dependencies

static build: ghc: can't find a package database

i use the following default.nix to static build:
https://github.com/clojurians-org/nix-haskell-build/blob/master/postgrest/default.nix
the nix-shell --runs 'cabal new-repl' is successsful and also cabal build.
but i get error with 'nix-build':

compileBuildDriverPhase
setupCompileFlags: -package-db=/build/setup-package.conf.d -j8 -threaded
Loaded package environment from /build/postgrest/.ghc.environment.x86_64-linux-8.4.3
ghc: can't find a package database at /home/larluo/.cabal/store/ghc-8.4.3/package.db
builder for '/nix/store/shlrhn20iimxra5nxdnn87rdicyl8blk-postgrest-5.2.0.drv' failed with exit code 1
error: build of '/nix/store/shlrhn20iimxra5nxdnn87rdicyl8blk-postgrest-5.2.0.drv' failed

cannot build Haskell programs that depend on gtk+3 statically

I'm trying to build a Haskell executable (Termonad) statically that uses gi-gtk, which is built using haskell-gi and depends on gtk+3.

It appears to be failing when building systemd.

Termonad depdends on gi-gtk, which depends on gtk+3, which depends on at-spi2-atk, which depends on dbus, which depends on systemd.

I can include the output from the failed systemd build if it would help.

Alternatively, here is the derivation I am trying to build:

let
  survey = import ./survey { normalPkgs = import ./nixpkgs {}; };

  termonad-pkg =
    { mkDerivation, adjunctions, base, Cabal, cabal-doctest
    , classy-prelude, colour, constraints, containers, data-default
    , directory, distributive, doctest, dyre, filepath, focuslist
    , genvalidity-containers, genvalidity-hspec, gi-gdk, gi-gio
    , gi-glib, gi-gtk, gi-pango, gi-vte, gtk3, haskell-gi-base
    , hedgehog, inline-c, lens, libpcre2, mono-traversable
    , pretty-simple, QuickCheck, singletons, stdenv, tasty
    , tasty-hedgehog, tasty-hspec, template-haskell, text, vte_291
    , xml-conduit, xml-html-qq
    }:
    mkDerivation {
      pname = "termonad";
      version = "2.0.0.0";
      sha256 = "0rprqn5vcvhbqqg0grrmz0ijjpkrprza88la4mbdg6skb34fjsp0";
      isLibrary = true;
      isExecutable = true;
      enableSeparateDataOutput = true;
      setupHaskellDepends = [ base Cabal cabal-doctest ];
      libraryHaskellDepends = [
        adjunctions base classy-prelude colour constraints containers
        data-default directory distributive dyre filepath focuslist gi-gdk
        gi-gio gi-glib gi-gtk gi-pango gi-vte haskell-gi-base inline-c lens
        mono-traversable pretty-simple QuickCheck singletons text
        xml-conduit xml-html-qq
      ];
      libraryPkgconfigDepends = [ gtk3 libpcre2 vte_291 ];
      executableHaskellDepends = [ base ];
      testHaskellDepends = [
        base doctest genvalidity-containers genvalidity-hspec hedgehog lens
        QuickCheck tasty tasty-hedgehog tasty-hspec template-haskell
      ];
      homepage = "https://github.com/cdepillabout/termonad";
      description = "Terminal emulator configurable in Haskell";
      license = stdenv.lib.licenses.bsd3;
    };

  myHaskellPackages =
    survey.haskellPackages.override {
      overrides = self: super: {
        termonad = self.callPackage termonad-pkg {
          libpcre2 = survey.pkgs.pcre2;
          vte_291 = survey.pkgs.gnome3.vte;
        };

        gi-gtk = survey.pkgs.haskell.lib.unmarkBroken super.gi-gtk;

        gi-vte = survey.pkgs.haskell.lib.unmarkBroken super.gi-vte;
      };
    };
in

myHaskellPackages.termonad

Note the following:

  • termonad-pkg is generated using cabal2nix. The current version of termonad in nixpkgs would probably work too.
  • gi-gtk and gi-vte (Haskell dependencies of Termonad) are marked broken, probably because they don't compile with the latest version of GTK+3. I'm not worried about this, since this also occurs when building with dynamic linking. (I'm mostly concerned with getting GTK+3 built statically, so that I can work on creating static builds of Termonad).
  • I'm using the latest HEAD of static-haskell-nix, which is commit 761f34b.

It is possible this should just be an issue on the nixpkgs repo. If this is the case, I will move it there.

No such package rio-0.1.10.0 in the cabal database

Just filing this issue to be more googleable.

@borsboom got, when building the latest stack with https://github.com/nh2/static-haskell-nix/blob/master/static-stack/default.nix:

$ $(nix-build --no-link -A fullBuildScript --argstr stackDir ~/stack-release)
โ€ฆ
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.2.2 cabal://zlib-0.6.2
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.2.2 cabal://zlib-bindings-0.1.1.5
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.2.2 cabal://zot-0.0.3
stack2nix: user error (No such package rio-0.1.10.0 in the cabal database. Did you run cabal update?)

I suspect it's related to Cabal revisions or that date I tell to Hackage to pin against Cabal revisions.

I expect that the answer is that he has to bump this line to a date that is new enough to have the rio version he wants:

hackageSnapshot = "2019-05-08T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions

The issue can be closed if my suspicion is correct, and the error message should then be googleable.

glibc build error with musl on nixpkgs master

In my new nightly build against nixpkgs master

https://buildkite.com/nh2/static-haskell-nix/builds/85#8e61f177-7a78-4c39-935d-e721c593a150/6-2314

It's building glibc-2.27 with musl, getting error:

../sysdeps/unix/sysv/linux/x86/gettimeofday.c:42:41: error: โ€˜__gettimeofdayโ€™ alias between functions of incompatible types โ€˜int(struct timeval *, struct timezone *)โ€™ and โ€˜int (*(void))(struct timeval *, struct timezone *)โ€™ [-Werror=attribute-alias]
...

cc1: all warnings being treated as errors

@dtzWill or @matthewbauer Do you know this problem?

nix tests fail with musl

When trying to build pkgsMusl.nix the tests fail, complaining about a missing unshare executable. This is mainly of significance because I'm trying to use callCabal2Nix from the Haskell library.

nixpkgs master build: openssh/krb5 build error

https://buildkite.com/nh2/static-haskell-nix/builds/158#eae147db-3177-4ab0-9a49-3140285d13fa/23-10930

In file included from ../openbsd-compat/openbsd-compat.h:193,
                 from ../includes.h:174,
                 from port-aix.c:27:
../openbsd-compat/bsd-misc.h:134:39: error: expected identifier or โ€˜(โ€™ before โ€˜doโ€™
 # define krb5_free_error_message(a,b) do { } while(0)
                                       ^~
../openbsd-compat/bsd-misc.h:134:46: error: expected identifier or โ€˜(โ€™ before โ€˜whileโ€™
 # define krb5_free_error_message(a,b) do { } while(0)
                                              ^~~~~
In file included from /nix/store/ivxdscf0zmi2jjkjmhj5dxk0zmrxvv2x-libkrb5-1.17-dev/include/krb5/krb5.h:8598,
                 from /nix/store/ivxdscf0zmi2jjkjmhj5dxk0zmrxvv2x-libkrb5-1.17-dev/include/krb5.h:8,
                 from ../auth.h:40,
                 from port-aix.c:34:
/nix/store/ivxdscf0zmi2jjkjmhj5dxk0zmrxvv2x-libkrb5-1.17-dev/include/com_err.h:54:65: error: conflicting types for โ€˜error_messageโ€™
 extern /*@observer@*//*@dependent@*/ const char * KRB5_CALLCONV error_message
                                                                 ^~~~~~~~~~~~~
In file included from ../includes.h:171,
                 from port-aix.c:27:
../defines.h:665:43: note: previous declaration of โ€˜error_messageโ€™ was here
 #  define krb5_get_err_text(context,code) error_message(code)
                                           ^~~~~~~~~~~~~
make[1]: *** [Makefile:99: port-aix.o] Error 1
make[1]: Leaving directory '/build/openssh-8.1p1/openbsd-compat'
make: *** [Makefile:170: openbsd-compat/libopenbsd-compat.a] Error 2
builder for '/nix/store/ll53yyymwwflgj5l4i5gpk6bwlh7dh9d-openssh-8.1p1.drv' failed with exit code 2

Explanation: https://gist.github.com/stumbles/67c54b228df0a5d2b65d53190e4cbea4#gistcomment-3097757

Ah, I've got it: this is the error message you get when you define function with the same name as a macro that already exists. Example:

# define krb5_free_error_message(a,b) do { } while(0)

void krb5_free_error_message(a,b) {}

So this must mean that after https://github.com/openssh/openssh-portable/blob/2ff822eabd7d4461743f22d3b9ba35ab76069df5/openbsd-compat/bsd-misc.h#L134-L136

#ifndef HAVE_KRB5_FREE_ERROR_MESSAGE
# define krb5_free_error_message(a,b) do { } while(0)
#endif

is executed, something #includes the krb5.h header file that defines krb5_free_error_message as a function.


Doing grep -R krb5_free_error_message . in the --keep-failed dir I seen in config.log:

  $ ./configure --prefix=/nix/store/ndgg2ayi185j5r12s66fgi1937l462s9-openssh-8.1p1 --sbindir=${out}/bin --localstatedir=/var --with-pid-dir=/run --with-mantype=man --with-libedit=yes --disable-strip --with-pam --sysconfdir=/etc/ssh --with-kerberos5=/nix/store/4ra3djsv1shbx2ycwjfgjvj0l1fz06fg-libkrb5-1.17
...
... lots more krb5 linker errors ...
...
/nix/store/jj5wh2i04zqjmsqiw2kq3fdzm0sl97d7-binutils-2.31.1/bin/ld: /nix/store/4ra3djsv1shbx2ycwjfgjvj0l1fz06fg-libkrb5-1.17/lib/libkrb5.a(kerrs.o): in function `krb5_free_error_message':
(.text+0x4ad): undefined reference to `k5_free_error'
...
... lots more krb5 linker errors ...
...
ac_cv_func_krb5_free_error_message=no

and in the configure output:

checking for krb5_free_error_message... no
...
                 KerberosV support: yes

So it enabled kerberos support (yes), but its internal checks for e.g. ac_cv_func_krb5_free_error_message failed, but not because (as was probably intended) the function isn't defined in the header, but because of a linker error.

So then autoconf silently continues (as usual ๐Ÿ‘Ž), with krb5 support on but the HAVE_ set to false, does its own define of krb5_free_error_message, includes krb.h and then fails.

So I think 2 (IMO) garbage behaviours of autoconf are at play:

  • Enabling krb5 support when it clearly doesn't work (maybe the configure.ac of openssh is written incorrectly?)
  • Claiming that a linker error indicates absence of a function, as opposed to a programmer error.

Cannot build static-stack for stack(source code) v2.1.3

Environment

Ubuntu 16.04(Virtualbox)

System GHC: (base) redy@redy-VirtualBox:~/Desktop/static-haskell-nix/static-stack$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.10.3 (installed directly from apt)

Reproduction

  1. clone Stack, checkout to tag v2.1.3 to ~/Desktop/stack.
  2. clone this project to ~/Desktop/stack-haskell-nix, get in and git submodule init && git submodule update --recursive
  3. cd static-stack , $(nix-build --no-link -A fullBuildScript --argstr stackDir /home/redy/Desktop/stack):
...
building '/nix/store/l12csrx3ngsvd8pqz8x7hbwgmx838p6v-nix-prefetch-scripts.drv'...

Ensuring git version is >= 2 ...
Ensuring cabal version is >= 2 ...
stack2nix: haskell.compiler.ghc822 failed to build via nix:
error: attribute 'ghc822' in selection path 'haskell.compiler.ghc822' not found

CallStack (from HasCallStack):
  error, called at src/Stack2nix/Util.hs:79:22 in stack2nix-0.2.3-6XVhBtEop6H39w4gsmgj0D:Stack2nix.Util

Patch cabal to pass --static flags to pkg-config

pkg-config takes a --static flag to output .a files for --libs. We currently add those manually in static-haskell-nix.

Instead, we should teach cabal to pass it, given that .cabal files can specify pkg-config dependencies.

Hopefully we can then get rid of pkg-config related overrides in static-haskell-nix and fundamentally fix issues like #57, so that Haskell libraries "remember" which static system libraries they need.

Can't build stack project

On lts-13.28
stack2nix: user error (No such package ALUT-2.4.0.3 in the cabal database. Did you run cabal update?)

Static libraries

Is it possible to use this infrastructure to also build static libraries?

Upgrading to nixpkgs master

The latest nixpkgs master has all fixes I had in my nixpkgs commit 50677e464359947f2a71cfd497c4022e3cdf8c7d.

So I'd like to just switch to a nixpkgs master commit.

Cannot build my program statically

I'm trying to build my program (https://gitlab.com/filipg/geval) statically using the approach with Stack (https://github.com/nh2/static-haskell-nix#building-stack-projects), see the default.nix file: https://gitlab.com/filipg/geval/blob/master/default.nix

Unfortunately, I got the following error:

[1 of 1] Compiling Main             ( app/Main.hs, dist/build/geval/geval-tmp/Main.o )
Linking dist/build/geval/geval ...
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: cannot find -lcairo
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: cannot find -llzma
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)

Is there a simple way to overcome this problem?

Cannot build `cachix`

In cachix/cachix#184 (comment) it was suggested that

NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz nix-build --no-link survey/default.nix -A haskellPackages.cachix

would build a static version of cachix. Unfortunately, it fails here:

~/build/haskell/static-haskell-nix $ NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz nix-build --no-link survey/default.nix -A haskellPackages.cachix -j8 --builders ''
โ€ฆ
running tests
Running 2 test suites...
Test suite spec: RUNNING...
[ 6 of 15] Compiling Data.Swagger.Lens ( src/Data/Swagger/Lens.hs, dist/build/Data/Swagger/Lens.o )
[ 7 of 15] Compiling Data.Swagger.SchemaOptions ( src/Data/Swagger/SchemaOptions.hs, dist/build/Data/Swagger/SchemaOptions.o )
[ 8 of 15] Compiling Data.Swagger.Internal.ParamSchema ( src/Data/Swagger/Internal/ParamSchema.hs, dist/build/Data/Swagger/Internal/ParamSchema.o )
[ 9 of 15] Compiling Data.Swagger.ParamSchema ( src/Data/Swagger/ParamSchema.hs, dist/build/Data/Swagger/ParamSchema.o )
[10 of 15] Compiling Data.Swagger.Internal.Schema ( src/Data/Swagger/Internal/Schema.hs, dist/build/Data/Swagger/Internal/Schema.o )
[11 of 15] Compiling Data.Swagger.Schema ( src/Data/Swagger/Schema.hs, dist/build/Data/Swagger/Schema.o )
[12 of 15] Compiling Data.Swagger.Operation ( src/Data/Swagger/Operation.hs, dist/build/Data/Swagger/Operation.o )
[13 of 15] Compiling Data.Swagger.Internal.Schema.Validation ( src/Data/Swagger/Internal/Schema/Validation.hs, dist/build/Data/Swagger/Internal/Schema/Validation.o )
[14 of 15] Compiling Data.Swagger.Schema.Validation ( src/Data/Swagger/Schema/Validation.hs, dist/build/Data/Swagger/Schema/Validation.o )
[15 of 15] Compiling Data.Swagger     ( src/Data/Swagger.hs, dist/build/Data/Swagger.o )
[ 1 of 15] Compiling Data.Swagger.Declare ( src/Data/Swagger/Declare.hs, dist/build/Data/Swagger/Declare.p_o )

src/Data/Swagger/Declare.hs:165:46: warning: [-Wdeprecations]
    In the use of type constructor or class โ€˜ListTโ€™
    (imported from Control.Monad.List, but defined in Control.Monad.Trans.List):
    Deprecated: "This transformer is invalid on most monads"
    |
165 | instance MonadDeclare d m => MonadDeclare d (ListT m) where
    |                                              ^^^^^
[ 2 of 15] Compiling Data.Swagger.Internal.AesonUtils ( src/Data/Swagger/Internal/AesonUtils.hs, dist/build/Data/Swagger/Internal/AesonUtils.p_o )
[ 3 of 15] Compiling Data.Swagger.Internal.TypeShape ( src/Data/Swagger/Internal/TypeShape.hs, dist/build/Data/Swagger/Internal/TypeShape.p_o )
[ 4 of 15] Compiling Data.Swagger.Internal.Utils ( src/Data/Swagger/Internal/Utils.hs, dist/build/Data/Swagger/Internal/Utils.p_o )
[ 5 of 15] Compiling Data.Swagger.Internal ( src/Data/Swagger/Internal.hs, dist/build/Data/Swagger/Internal.p_o )

Servant.Auth.Server
  The Auth combinator
    returns a 401 if all authentications are Indefinite
    succeeds if one authentication suceeds
      +++ OK, passed 100 tests.
    fails (403) if one authentication fails
      # PENDING: Authentications don't yet fail, only are Indefinite
    doesn't clobber pre-existing response headers
      +++ OK, passed 100 tests.
    Raw
      gets the response body
        +++ OK, passed 100 tests.
      doesn't clobber pre-existing reponse headers
        +++ OK, passed 100 tests.
    Setting cookies
      sets cookies that it itself accepts
        +++ OK, passed 100 tests.
      uses the Expiry from the configuration
        +++ OK, passed 100 tests.
      sets the token cookie as HttpOnly
        +++ OK, passed 100 tests.
  The Auth combinator
    With XSRF check
      fails if XSRF header and cookie don't match FAILED [1]
      fails with no XSRF header or cookie
        +++ OK, passed 100 tests.
      succeeds if XSRF header and cookie match, and JWT is valid
        +++ OK, passed 100 tests.
      sets and clears the right cookies
        +++ OK, passed 100 tests.
    With no XSRF check for GET requests
      succeeds with no XSRF header or cookie for GET
        +++ OK, passed 100 tests.
      fails with no XSRF header or cookie for POST
        +++ OK, passed 100 tests.
    With no XSRF check at all
      succeeds with no XSRF header or cookie for GET
        +++ OK, passed 100 tests.
      succeeds with no XSRF header or cookie for POST
        +++ OK, passed 100 tests.
      sets and clears the right cookies
        +++ OK, passed 100 tests.
  The JWT combinator
    fails if 'aud' does not match predicate
      +++ OK, passed 100 tests.
    succeeds if 'aud' does match predicate FAILED [2]
    fails if 'nbf' is set to a future date
      +++ OK, passed 100 tests.
    fails if 'exp' is set to a past date
      +++ OK, passed 100 tests.
    succeeds if 'exp' is set to a future date
      +++ OK, passed 100 tests.
    fails if JWT is not signed
      +++ OK, passed 100 tests.
    fails if JWT does not use expected algorithm
      # PENDING: Need https://github.com/frasertweedale/hs-jose/issues/19
    fails if data is not valid JSON
    suceeds as wreq's oauth2Bearer
      +++ OK, passed 100 tests.
  throwAll
    works for plain values
    works for function types
      +++ OK, passed 100 tests.
  The BasicAuth combinator
    succeeds with the correct password and username
    fails with non-existent user
    fails with incorrect password
    fails with no auth header

Failures:

  test/Servant/Auth/ServerSpec.hs:526:32:
  1) Servant.Auth.Server, The Auth combinator, With XSRF check, fails if XSRF header and cookie don't match
       Falsifiable (after 73 tests):
         User {name = "o~8fr\SOIB\7288\ETXr\594666.x\936020HF@\943883I\260569Sf=\305132U\ESC|\321218\&7\675297\1065722}\334695\feI6\322731{\50885~~\DEL\\\341886\RS\878266g\874217\1065911\v\RS\723836i\697751\963120i\ACK\374486K\997076", _id = "^\585134\831983zqkJ\DC4R G\NAK\435941%\r\vRJ\535080)6N\SI\264671\385762$+}#\452437_AV\ETX\1085042\NUL\SOH`M\1046392\1036372\189890\445035\SUB&n%!\451181yU\\\ETB\293643"}
       predicate failed on expected exception: HttpException (HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 38215
         secure               = False
         requestHeaders       = [("Cookie","TheyDinedOnMince=blerg; RuncibleSpoon=eyJhbGciOiJIUzI1NiJ9.eyJkYXQiOnsiX2lkIjoiXvKOtq7zi4evenFrSlx1MDAxNFIgR1x1MDAxNfGqm6UlXHJcdTAwMGJSSvKCqKgpNk5cdTAwMGbxgKef8Z6LoiQrfSPxrp2VX0FWXHUwMDAz9Ii5slx1MDAwMFx1MDAwMWBN87-duPO9gZTwrpeC8aypq1x1MDAxYSZuJSHxromteVVcXFx1MDAxN_GHrIsiLCJuYW1lIjoib344ZnJcdTAwMGVJQuGxuFx1MDAwM3LykYuqLnjzpKGUSEZA86aci0nwv6eZU2Y98YqfrFVcdTAwMWJ88Y6bgjfypLeh9ISLun3xka2nXHUwMDBjZUk28Y6yq3vsm4V-fn9cXPGTnb5cdTAwMWXzlpq6Z_OVm6n0hI63XHUwMDBiXHUwMDFl8rCtvGnyqpaX86uIsGlcdTAwMDbxm5uWS_Ozm5QifX0.rxoQ5jx5YSE14jcs12OUQWXnAf9fTFI3rmcwHug2a9k"),("AndSlicesOfQuince","blah"),("User-Agent","haskell wreq-0.5.2.1")]
         path                 = "/"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        (InternalException Network.Socket.recvBuf: resource vanished (Connection reset by peer)))

  To rerun use: --match "/Servant.Auth.Server/The Auth combinator/With XSRF check/fails if XSRF header and cookie don't match/"

  test/Servant/Auth/ServerSpec.hs:291:3:
  2) Servant.Auth.Server, The JWT combinator, succeeds if 'aud' does match predicate
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 36609
         secure               = False
         requestHeaders       = [("Authorization","<REDACTED>"),("User-Agent","haskell wreq-0.5.2.1")]
         path                 = "/"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        (InternalException Network.Socket.recvBuf: resource vanished (Connection reset by peer))
       (after 72 tests)
         User {name = "{i\DC22)>", _id = "\648735\931178Y7gi\311350\ENQ\FSN\ENQK6\137112\r\287965\439247\961389\242656\1072694\&9`S\r:t'h/V~rT\727610E\DC2\SOH\NULL\SI\EOT#\SYNz\fi:Tq[awDC\EOT\872054\554206l_3_"}

  To rerun use: --match "/Servant.Auth.Server/The JWT combinator/succeeds if 'aud' does match predicate/"

Randomized with seed 1298701833

Finished in 61.8818 seconds
33 examples, 2 failures, 2 pending
Test suite spec: FAIL
Test suite logged to: dist/test/servant-auth-server-0.4.0.0-spec.log
Test suite readme: RUNNING...
Test suite readme: PASS
Test suite logged to: dist/test/servant-auth-server-0.4.0.0-readme.log
1 of 2 test suites (1 of 2 test cases) passed.
builder for '/nix/store/82nll6705z1hw05g4afp4427nr510i5z-servant-auth-server-0.4.0.0.drv' failed with exit code 1

Cache not working?

I have set up the cache as indicated:

/tmp $ cat /etc/nix/nix.conf 
binary-caches = https://cache.nixos.org https://nixcache.reflex-frp.org https://static-haskell-nix.cachix.org
binary-cache-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI= static-haskell-nix.cachix.org-1:Q17HawmAwaM1/BfIxaEDKAxwTOyRVhPG5Ji9K3+FvUU=

and now I would expect that building a static haskell binary using the version of nixpkgs indicated in the README would fetch stuff, at least ghc itself, from the cache. But it seems it wants to build everything:

/tmp $ nix-build -A pkgsMusl.haskell.packages.ghc843.hello  https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz
unpacking 'https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz'...
these derivations will be built:
  /nix/store/8hl5iahxgbbv5l4k6x79g80appfbrmwn-busybox.drv
  /nix/store/jjpi1ygks4vrqzwayl39kpq4q4dbdc95-bootstrap-tools.tar.xz.drv
  /nix/store/4bch7i6bphc0js0n87xs1avsjma8r92a-bootstrap-tools.drv
  /nix/store/15vd9kcacnzp8rw3636v0i9j5517ifbq-bootstrap-stage0-stdenv-linux.drv
  /nix/store/fl8z9ll3in2q4m87qkrdgp7nkcsb3fzb-bootstrap-stage0-musl.drv
  /nix/store/s4fk0vi096vsx8x8pc7cl24jasc22ad0-bootstrap-stage0-binutils-wrapper.drv
  /nix/store/4nlj1vz49rz5k5myr589dp03w49qskhq-bootstrap-stage1-gcc-wrapper.drv
  /nix/store/r5cv8d1wcgh61sxscg8gdvhz4i87zhjd-bootstrap-stage1-stdenv-linux.drv
  /nix/store/a0vzxg08wj18r5ph2kizgj35nbg7pdk9-expand-response-params.drv
  /nix/store/gwiy8iw00qssbyjklvnbkp8ng3w7wkl8-bootstrap-stage1-stdenv-linux.drv
  /nix/store/7ni39q9xybnaiyfrk8kadbkq0b92gw70-zlib-1.2.11.drv
  /nix/store/3nlcd3z5ns3svrdfvd4qy17xfhj2znbj-gnum4-1.4.18.drv
  /nix/store/a3mk8rmxy6cviqqk52wdr615cawws5yh-perl-5.24.3.drv
  /nix/store/99m78r8s5jzzdkgwxq9lgyy8g95indwl-bison-3.0.5.drv
  /nix/store/pvz59sfyj3lhdph86ml9dm8c0l5lpnsi-binutils-2.30.drv
  /nix/store/yzjsdcbfk60kwqpfrmchnghfjxcx59qr-binutils-wrapper-2.30.drv
  /nix/store/kdab5fyr02a1m6ki3rws8rw7izlcdx52-bootstrap-stage2-gcc-wrapper.drv
  /nix/store/ipfbyvn22s9a2hi4chr3yhw6azs78q8y-bootstrap-stage2-stdenv-linux.drv
  /nix/store/c349lj57w8vcjg8bimj1xxvdngx0gk8x-patchelf-0.9.drv
  /nix/store/l8fiq82vc28jhm4cn4z24s2adm3ddvsl-paxctl-0.9.drv
  /nix/store/2lbk1njyh691b080nlgwm19s0xd7l0l3-bootstrap-stage2-stdenv-linux.drv
  /nix/store/a1fr1iy0jibdc715ffy35nsaz1rf4nhp-linux-headers-4.15.drv
  /nix/store/q9365c8y423igv7zvfk1kxl9pvfd4cdy-musl-1.1.19.drv
  /nix/store/j9azlhpara82nqv803mp8pry9q4d5da4-binutils-wrapper-2.30.drv
  /nix/store/xxc1w5756qpszj22zf9x3cg3jqayak3g-expand-response-params.drv
  /nix/store/xsfvy3w12my6fjwd0hb2ja8kbr3lj91m-bootstrap-stage3-gcc-wrapper.drv
  /nix/store/1bl38wr9ni2lhac8kkbm2pvm6jclckm8-bootstrap-stage3-stdenv-linux.drv
  /nix/store/0x91rrqxbyl2kg9a4wkw2is553544y4q-xz-5.2.4.drv
  /nix/store/jhc50xgvlsj37772qhi3pxgpmgq43k83-expand-response-params.drv
  /nix/store/4vg5xfpxx2lqjwc948d7l75gfhbs8p10-which-2.21.drv
  /nix/store/hkm9zlbz1ij3vgq7qvryp4kw2vqk432w-gmp-6.1.2.drv
  /nix/store/bf3rlmdbf2fnry06zhj21vgc96119lch-isl-0.17.1.drv
  /nix/store/d835xl49rvbmg6hpycr0xsxjp0wri3df-mpfr-4.0.1.drv
  /nix/store/fqzkzb153xhqq3fsndx099286d7a65d7-gettext-0.19.8.1.drv
  /nix/store/r0dpalavs6ga2xl69vz9zl4l15h1ab4w-texinfo-6.5.drv
  /nix/store/sk6khfg725hlvmwdjkm5vljrpiqdcaa5-zlib-1.2.11.drv
  /nix/store/zqc2ai9qlzbcaavxagq40gjc9r1f4qv5-libmpc-1.1.0.drv
  /nix/store/zyy1lssaxcvlpi6pl66mavnnfmn62i54-libelf-0.8.13.drv
  /nix/store/v4gm6y2zfj5c73m1cp8i944hx8kmzy8v-gcc-7.3.0.drv
  /nix/store/49q5dmynsv8bx5s2b2cwm7i44i7nf161-bootstrap-stage4-gcc-wrapper-7.3.0.drv
  /nix/store/021y6371h84hpzyd4drwvgvsfxcf62cq-bootstrap-stage4-stdenv-linux.drv
  /nix/store/6yx3hjmg5jc76dbhbf3snss27s8n1kqc-binutils-2.30.drv
  /nix/store/g6kk34wh90s5z2sa2laldadvngpv93j1-bootstrap-stage4-stdenv-linux.drv
  /nix/store/2y2v0q9y8jrsz8brczvvfy5qi7a5c2bd-musl-iconv-1.1.19.drv
  /nix/store/kw28xdlrl4s63npizhfq6g6rdl37163i-pcre-8.41.drv
  /nix/store/pks7ijnss8n78pxzyq4haqyffpsiqa42-gnugrep-3.1.drv
  /nix/store/ifwnagnga5w67r14qwyf5wlz6aban1qr-autoconf-2.69.drv
  /nix/store/sb6d0g5fsxp04f5mrkw80mm06s03h6cb-bash-4.4-p23.drv
  /nix/store/817pj2sd73sfzjk9d3gd7pg7lkjdy5ip-xz-5.2.4.drv
  /nix/store/icxhbf6r8mqcq3wx42kflixkdwa5qz45-attr-2.4.47.drv
  /nix/store/99v3cckqq3l97bnxgg5gpwbwyykv0jvd-acl-2.2.52.drv
  /nix/store/xq06vlfy8xdk1y0946ckb5bhnsxcrs4c-coreutils-8.29.drv
  /nix/store/15hvr7cngd12l9i84bkpni55l54v2cia-binutils-wrapper-2.30.drv
  /nix/store/3yznwvz1w6slf68jv6laq0waqyypxd5c-patch-2.7.6.drv
  /nix/store/bxkhh1iwjjxpcng7i13ykgjgfgmaa04y-gawk-4.2.1.drv
  /nix/store/ppphv1kw83af6lkvpildv8rsj2h328ax-texinfo-6.5.drv
  /nix/store/p09jkj56bmzammmi7c6is5k7f2qd5h5p-lzip-1.20.drv
  /nix/store/csli3rap0rnzffi7ld4hs9qq15qfx3vz-ed-1.14.2.drv
  /nix/store/d1bh29yaafa5a1ksrq0ssma8s1ssmskl-gnutar-1.30.drv
  /nix/store/gj91l8gsy7cv17bq0r7qmr1dplgx4l6a-findutils-4.6.0.drv
  /nix/store/gq3jwjdshfnrdg9nhclqcz0rvxharjg8-patchelf-0.9.drv
  /nix/store/gzby5bn11693fc0741k4yv4q2f51ib5m-paxctl-0.9.drv
  /nix/store/h48laara9n8mnaka4h6dawf2adl4pfpv-gnumake-4.2.1.drv
  /nix/store/q2plzj674fpcn3l21l6gd184nszjizi2-gcc-wrapper-7.3.0.drv
  /nix/store/s0zq6q4bf7970m75rhig9qgxhyzljff9-diffutils-3.6.drv
  /nix/store/w954j324b55al7fmw04vlxl5kbjbv15n-gnused-4.5.drv
  /nix/store/z12j4n5ngjbjiqmc5iwiviz8w4gbmq0j-bzip2-1.0.6.0.1.drv
  /nix/store/zg2pzw85mzm0y7ign5fa09q2fvl0gzm6-gzip-1.9.drv
  /nix/store/0ki8by5cgm0jgd391fxims5c4jpb563h-stdenv-linux.drv
  /nix/store/2amwirrm2crgl0j3n7hkfg929slqk53x-python-setup-hook.sh.drv
  /nix/store/i928fgfssh6si0rjhps8r8a433jqrbs5-stdenv-linux.drv
  /nix/store/d9c50yp7fwj2cgznm1gcsy3jwf1rwbk8-perl-5.24.3.drv
  /nix/store/42s7f2mx7pjv16sw2f4s1qxz0fpjhhfh-openssl-1.0.2o.drv
  /nix/store/4pyryhh6lgjxijxnxcw669ffyi32ndmi-remove-references-to.drv
  /nix/store/5cqfm2dpbmi59cmbq9ch5gql7f2v6hh7-musl-iconv-1.1.19.drv
  /nix/store/yzfx5ymrf3v5dnni4i74r4rnlpkkrzh0-gnum4-1.4.18.drv
  /nix/store/65zdizh73ggl7s29qmxqbcfycc0d2acz-autoconf-2.69.drv
  /nix/store/6d03wxzpnbqx9sz9bv4hlcj5car0ycyj-automake-1.16.1.drv
  /nix/store/b2sazypy3cs1clyfkiygi9np90pnid1z-gmp-6.1.2.drv
  /nix/store/nvyiap1s08jcr7l5kzcch1finlq8hm9d-pkg-config-0.29.2.drv
  /nix/store/fvlbxz56ffijylr40iy352slssmhz2zr-ncurses-6.1-abi5-compat.drv
  /nix/store/kr8xsz7z04f56aikzn8ifcwnamq6v1cy-linux-headers-4.15.drv
  /nix/store/y3w4cpz9nrc3jjywjx026w1hn1n8kvga-bison-3.0.5.drv
  /nix/store/p9z8fq8whixp0hwwn9l4w5jwr5bpd6mv-glibc-2.27.drv
  /nix/store/r60zrvpqshk4lgz8yry4b8pb2dvgglm8-ghc-8.2.1-binary.drv
  /nix/store/9qw5ijflpkxdpyv84nm0081v1j1lglig-hscolour-1.24.4.drv
  /nix/store/9yvc6b00h9w4rin2igp9rs8svy1x7459-mtl-2.2.2.drv
  /nix/store/852n706x9w9b56lgv4h8iqjrvndgd04z-happy-1.19.9.drv
  /nix/store/8i5n7w1rz5xzn8kg9r0dlxr2vakq713w-alex-3.2.4.drv
  /nix/store/qjl3x749fiqhzhvknq5074cha4gybsbq-ncurses-6.1.drv
  /nix/store/ggg79hbg4dc01jr4himnfim22qgyghw4-readline-6.3p08.drv
  /nix/store/gpkn5gb30r18hxpvvhmswiw5bmdvmqjx-gdbm-1.14.1.drv
  /nix/store/j1bd657c5h5zblbadlnsdv2998d6bvk2-expat-2.2.5.drv
  /nix/store/syzsb8cb82y8wngdm1byx0ykbx6wi24k-libffi-3.2.1.drv
  /nix/store/yfwk31gx4nqdhm3s6vbkhmr04y4r5ivw-sqlite-3.24.0.drv
  /nix/store/alckd743zh6ndxzb595qwdf0rlms824x-python3-3.6.5.drv
  /nix/store/biz1wadfl4skiclmyq08ncbk2ahhwswy-hscolour-1.24.4.drv
  /nix/store/99vw0012bc3h69858v4iqb8227lwxcax-ghc-8.4.3.drv
  /nix/store/q3cjh18yqvw65sz4awifcrbl157ikacb-hello-1.0.0.2.drv
these paths will be fetched (243.24 MiB download, 243.70 MiB unpacked):
  /nix/store/1kw5bx8z2g8jvg3fb7kz0hqfzr87f2xi-openssl-1.0.2o.tar.gz
  /nix/store/7pgibwavfml4rg52r7si9kzylswi31w5-ghc-8.2.1-x86_64-deb8-linux.tar.xz
  /nix/store/hr3vy4i6w4391rchx0v9kn3whia0822a-tar-1.30.tar.xz
  /nix/store/qk6d52igqsnakwa8c8q5jmh16xfmdhpw-perl-5.24.3.tar.gz
  /nix/store/ys4vczdgib73vhr1a6xccl83vq9maqlg-linux-4.15.tar.xz
  /nix/store/z3rd18n6pg9bsgz6wchnxgxfkrhkrxm5-sqlite-autoconf-3240000.tar.gz
copying path '/nix/store/7pgibwavfml4rg52r7si9kzylswi31w5-ghc-8.2.1-x86_64-deb8-linux.tar.xz' from 'https://cache.nixos.org'...
^Cerror: interrupted by the user

Am I doing something wrong?

static-stack: Pin nixpkgs version in stack2nix invocation

In

PATH=${pkgs.cabal-install}/bin:${normalPkgs.nix}/bin:$PATH ${stack2nix}/bin/stack2nix -o stack.nix $@

I don't pin the nixpkgs version.

This means stack2nix will use whatever you have as <nixpkgs> right now for looking up what compilers exist, reducing reproducibility.

I should do e.g.

  nixpkgsUrl = https://github.com/NixOS/nixpkgs/archive/88ae8f7d55efa457c95187011eb410d097108445.tar.gz;

  normalPkgs = import (fetchTarball nixpkgsUrl) {};

and then

      export NIX_PATH=nixpkgs=${nixpkgsUrl}
      PATH=${pkgs.cabal-install}/bin:${normalPkgs.nix}/bin:$PATH ${stack2nix}/bin/stack2nix -o ops.nix $@

Couldn't build hmatrix due to a curl build error

Tried to build hamtrix with

NIX_PATH=nixpkgs=nixpkgs nix-build --no-link survey/default.nix -A haskellPackages.hmatrix

and got a build error for curl. Here's the last bit of the build output:

/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_ucs4_to_utf8'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_os_mutex_init'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_null_create_val'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_get_tid'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_path_split'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_object_count'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_array_add'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_string_create'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_string_unbase64'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_utf8_to_utf16le'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_open_plugin_dirs'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_once'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_utf8_to_ucs4'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_key_delete'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_get_space'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_free_filenames'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `add_key'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_set_error_info_callout_fn'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_open_plugin'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_vset_error'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_init_dynamic'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_hashtab_get'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_get_keyring_ID'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_encode'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_key_register'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_free'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_array_get'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_getspecific'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_release'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_object_create'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_unlink'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_gmt_mktime'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_hashtab_create'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_add'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_object_set'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_number_create'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_array_create'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_get_plugin_dir_data'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_clear'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_get_error'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_os_mutex_lock'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_path_join'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_number_value'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_add_fmt'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_get_persistent'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_get_plugin_func'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_getnameinfo'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_utf8_mintab'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_os_mutex_unlock'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_set_timeout'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_string_create_len'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_add_len'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_init_dynamic_zap'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_set_error'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_dir_filenames'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_bcmp'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_utf16le_to_utf8'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_free_plugin_dir_data'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_read_alloc'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_close_plugin'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_clear_error'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_getaddrinfo'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_string_utf8'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_describe_alloc'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_hashtab_add'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_close_plugin_dirs'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_os_mutex_destroy'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_buf_status'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_freeaddrinfo'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_link'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_decode'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_bool_value'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_setspecific'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_free_error'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `keyctl_search'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_object_get'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `krb5int_utf8_lentab'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_array_fmt'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_hashtab_remove'
/nix/store/ljx5sayk6w0bpd1ahcf0rm5fj55cqafd-binutils-2.31.1/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `k5_json_array_length'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:923: curl] Error 1
make[2]: Leaving directory '/build/curl-7.64.1/src'
make[1]: *** [Makefile:1967: all-recursive] Error 1
make[1]: Leaving directory '/build/curl-7.64.1/src'
make: *** [Makefile:923: all-recursive] Error 1
builder for '/nix/store/rlj4m1xj45wrispidf7719gpf9j2gp4w-curl-7.64.1.drv' failed with exit code 2
building '/nix/store/5my8sj5z1ah7nzx06518n25qg4c0f5c3-expand-response-params.drv'...
cannot build derivation '/nix/store/07s2vw3jd0fclh9d7i55axq9326fnmhn-hmatrix-Allow-disabling-random_r-usage-manually.patch.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/yyg8qq8dh3b7129zdn7ya8nzs00a1ym5-hmatrix-0.19.0.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/yyg8qq8dh3b7129zdn7ya8nzs00a1ym5-hmatrix-0.19.0.0.drv' failed

Document situations where not pinning the nix version changes outputs

In

# Full invocation, including pinning `nix` version itself.
I pin the version of nix itself.

I added that in the past because the upgrade from Nix 1.* to 2.0 created (if I remember correctly) different .drv files.

I would like to document cases beyond that which resulted in different .drvs or build outputs when the version of nix changes, so that I can justify to continue pinning nix:

.drv changes

  • During the ugprade from nix 1.* to 2.0

Output / build changes

Remove use of normalHaskellPackages?

@nmattia reported:

Turns out you don't use normalHaskellPackages anymore

This sounds like I forgot to remove it / its last uses in filtering the stackage executables while doing the switch to overlays.

Should do this after I have full CI for everything set up.

Fails to link against tinfo (ncurses5)

I am trying to build https://travis-ci.org/entropia/tip-toi-reveng/ statically using these instructions, and I made good progress by pinning nixpkgs to version NixOS/nixpkgs@2c07921 (which is the one mentioned in the README) and then buliding pkgs.pkgsMusl.haskell.packages.ghc843.tttool.

And indeed, as long as I stub out uses of TemplateHaskell in my program (it it expected that this is needed?), it buildsโ€ฆ almost: It fails linking

Linking dist/build/tttool/tttool ...
/nix/store/3a74d03pq6d0cg3crkfw965k5s58hbn4-binutils-2.30/bin/ld: cannot find -ltinfo
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
builder for '/nix/store/4z8hp5bslaxlgasq69k4njxl2z1hnwz2-tttool-1.8.1.drv' failed with exit code 1
error: build of '/nix/store/4z8hp5bslaxlgasq69k4njxl2z1hnwz2-tttool-1.8.1.drv' failed

Blindly cargo-culting the example scotty app, I tried adding the following to my project.nix

  configureFlags = pkgs.lib.optional static [
     "--ghc-option=-optl=-static"
     "--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
     "--extra-lib-dirs=${pkgs.zlib.static}/lib"
     "--extra-lib-dirs=${pkgs.ncurses5.override { enableStatic = true; }}/lib"
  ];

but it did not make a difference (and there was already a --extra-lib-dirs=/nix/store/1xwbnc903gymfi99zpvj8mdp5601yqz6-ncurses-6.1/lib commde line argument passed automatically somehow).

Is it maybe dubious that https://github.com/NixOS/nixpkgs/blob/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac/pkgs/development/libraries/ncurses/default.nix starts with

, enableStatic ? stdenv.hostPlatform.useAndroidPrebuilt

Stack build fails with "called without required argument text"

Excuse me if this is me simply not grokking something, but I can't seem to build my little project, which can be found here (including the "default.nix" file I am currently using.: https://github.com/david-janssen/kmonad

I run into "anonymous function at /nix/store/hash-stack2nix-output.nix called without required argument 'text'"

error: while evaluating the attribute 'static_package' at /nix/store/9f4057hjy1b4d3aawzlqxi6gl3lijchc-source/static-stack2nix-builder/default.nix:63:10:
while evaluating the attribute 'haskellPackages.kmonad' at undefined position:
while evaluating anonymous function at /nix/store/9f4057hjy1b4d3aawzlqxi6gl3lijchc-source/survey/default.nix:1133:35, called from undefined position:
while evaluating 'isProperHaskellPackage' at /nix/store/9f4057hjy1b4d3aawzlqxi6gl3lijchc-source/survey/default.nix:83:28, called from /nix/store/9f4057hjy1b4d3aawzlqxi6gl3lijchc-source/survey/default.nix:1134:15:
while evaluating 'isDerivation' at /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/lib/attrsets.nix:305:18, called from /nix/store/9f4057hjy1b4d3aawzlqxi6gl3lijchc-source/survey/default.nix:84:5:
while evaluating 'callPackage' at /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/pkgs/development/haskell-modules/make-package-set.nix:114:22, called from /nix/store/23pn22vxxcgnrp62a20sa0jgz9vky60v-stack2nix-output.nix:20431:18:
while evaluating 'callPackageWithScope' at /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/pkgs/development/haskell-modules/make-package-set.nix:74:37, called from /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/pkgs/development/haskell-modules/make-package-set.nix:114:28:
while evaluating 'makeOverridable' at /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/lib/customisation.nix:67:24, called from /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/pkgs/development/haskell-modules/make-package-set.nix:97:8:
while evaluating 'drvScope' at /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/pkgs/development/haskell-modules/make-package-set.nix:87:18, called from /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/lib/customisation.nix:69:12:
anonymous function at /nix/store/23pn22vxxcgnrp62a20sa0jgz9vky60v-stack2nix-output.nix:20432:10 called without required argument 'text', at /nix/store/c3xdy7989a3x52jqg98gwzbiwv8gcv49-source/pkgs/development/haskell-modules/make-package-set.nix:87:27

I am not entirely sure how to interpret the output above the error message, but I would half expect to find the 'text' package occuring somewhere around here:

+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://test-framework-quickcheck2-0.3.0.5
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://testing-feat-1.1.0.0
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://texmath-0.11.2.2
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://testing-type-modifiers-0.1.0.1
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://text-builder-0.6.5.1
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://text-binary-0.2.1.1

but I can't seem to find it anywhere either.

Am I missing something obvious?

Building arbitrary stack project failed: stack2nix: <stdout>: commitBuffer: invalid argument (invalid character)

I'm trying to build static executable from my stack project here.

It uses lts-13.26 so the this line shall not change:

compiler = "ghc865"; # matching stack.yaml

And my only change is this line, by filling cabalPackageName with purescript-python.

cabalPackageName = "example-project";

It seems due to this:

extra-deps:
- github: purescript/purescript
  commit: ed130c78b708ff55cf4a80b126a1bd3ba5d80eb9

I got genNixFile: No support for archive package locations, so I change it to

extra-deps:
- purescript-0.13.6

which is the version closest to their master branch.

Finally I got this error and cannot work it out after a while:

+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 /home/redy/+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://pushbullet-types-0.4.1.0
+ cabal2nix --subpath . --system x86_64-linux --compiler ghc-8.6.5 cabal://pusher-http-haskell-1.5.1.9
stack2nix: <stderr>: commitBuffer: invalid argument (invalid character)

This is strange, because this seems to be a solved issue: input-output-hk/stack2nix#150 .

I also tried adding export LC_ALL=en_US.UTF-8 before building.

Before each building I cleanup things and retry $(nix-build ...)

build haskell static project failed: nix-2.0.4: make: *** [mk/tests.mk:12: installcheck] Error 1

i build a simple project with the following configure on readhat7.

{ pkgs ? (import (builtins.fetchTarball {url="https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz";}) {}).pkgsMusl} :

with pkgs;
let
  haskellPackages = pkgs.haskellPackages.override {
    overrides = self: super: with pkgs.haskell.lib; {
      # conduit = doJailbreak super.conduit ;
      # nix-fetch-url https://github.com/bos/criterion/releases/tag/criterion-1.5.5.0

      # minio-hs = dontCheck (doJailbreak (self.callCabal2nix "minio-hs"
      #   (pkgs.fetchFromGitHub {
      #     owner = "minio" ;
      #     repo = "minio-hs" ;
      #     rev = "v1.2.0" ;
      #     sha256 = "1ybihlmbcsl4biak4b2wbl7dz2n03mar4hvhz148mkfal9dr9agw" ;
      #   }) {})) ;
    } ;
  } ;
  pkg = haskellPackages.developPackage {
    root = ./.;

    modifier = drv: haskell.lib.overrideCabal drv (attrs: {
      buildTools = (attrs.buildTools or []) ++ [haskellPackages.cabal-install] ;

      isLibrary = false;
      isExecutable = true;
      enableSharedExecutables = false;
      enableSharedLibraries = false;
      configureFlags = [
          "--ghc-option=-optl=-static"
          "--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
          "--extra-lib-dirs=${pkgs.zlib.static}/lib"
          "--disable-executable-stripping"
      ];

    }) ;
  } ;
  buildInputs = [ ] ;
in pkg.overrideAttrs(attrs: {
  buildInputs = attrs.buildInputs ++ buildInputs ;
})

[op@my-200 minio-migration]$ cat minio-migration.cabal
cabal-version:       >=1.10
-- Initial package description 'minio-migration.cabal' generated by 'cabal
-- init'.  For further documentation, see
-- http://haskell.org/cabal/users-guide/

name:                minio-migration
version:             0.1.0.0
-- synopsis:
-- description:
-- bug-reports:
license:             BSD3
license-file:        LICENSE
author:              clojurians-org
maintainer:          [email protected]
-- copyright:
-- category:
build-type:          Simple
extra-source-files:  CHANGELOG.md
executable minio-migration
  main-is:             Main.hs
  -- other-modules:
  -- other-extensions:
  build-depends:
      base
    , data-default
    , bytestring
    , base64-bytestring
    , text
    , aeson
    , transformers
    , string-conv
    , containers
    , unordered-containers
    , time
    , retry
    , criterion-measurement
    , resourcet
    , conduit
    , conduit-extra
    , stm-chans
    , stm-conduit
    , unliftio-core
    , unliftio
--    , minio-hs
    , protolude
    , binary
    , digest
    , ini
    , memory
    , raw-strings-qq
    , case-insensitive
    , filepath
    , directory
    , http-types
    , http-client
    , http-conduit
    , xml-conduit
    , cryptonite
    , cryptonite-conduit
  hs-source-dirs:      src
  default-language:    Haskell2010
  default-extensions:
      OverloadedStrings
    , NoImplicitPrelude
    , FlexibleContexts
    , FlexibleInstances
    , MultiParamTypeClasses
    , ScopedTypeVariables
    , TypeFamilies
    , MultiWayIf

    , BangPatterns
    , TupleSections

it finally failed :

[op@my-200 minio-migration]$ nix-shell --run 'cabal new-repl'
building '/nix/store/d9iciyfgp3f8zwchck8lhnac0clmbqj0-nix-2.0.4.drv'...
unpacking sources
unpacking source archive /nix/store/jc8wmgzcfynd8dvgbbgr0jzrz65bl8sq-nix-2.0.4.tar.xz
source root is nix-2.0.4
setting SOURCE_DATE_EPOCH to timestamp 1527696660 of file nix-2.0.4/src/libexpr/parser-tab.hh
patching sources
configuring
...
...
checking for references to /tmp/nix-build-nix-2.0.4.drv-0 in /nix/store/080qimnmjr55z0z8bxii76vnw24say5j-nix-2.0.4-debug...
running install tests
installcheck flags: -j4 -l4 SHELL=/nix/store/v2hmssglxm87bxg29227zpgjnr2j98vn-bash-4.4-p23/bin/bash profiledir=\$\(out\)/etc/profile.d installcheck
  GEN    tests/common.sh
  CXX    tests/plugins/plugintest.o
  LD     tests/plugins/libplugintest.so
running test tests/init.sh... [PASS]
running test tests/hash.sh... [PASS]
...
...
running test tests/linux-sandbox.sh... [FAIL]
    + clearStore
    + echo 'clearing store...'
    clearing store...
    + chmod -R +w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + nix-store --init
    + clearProfiles
    + profiles=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + canUseSandbox
    ++ uname
    + [[ Linux != Linux ]]
    + '[' '!' -L /proc/self/ns/user ']'
    + '[' -e /proc/sys/kernel/unprivileged_userns_clone ']'
    + return 0
    + [[ ! /nix/store/v2hmssglxm87bxg29227zpgjnr2j98vn-bash-4.4-p23/bin/bash =~ /nix/store ]]
    + chmod -R u+w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    chmod: cannot access '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0': No such file or directory
    + true
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    + export NIX_STORE_DIR=/my/store
    + NIX_STORE_DIR=/my/store
    + export NIX_REMOTE=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    + NIX_REMOTE=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    ++ nix-build dependencies.nix --no-out-link --sandbox-paths /nix/store
    these derivations will be built:
      /my/store/4jhhssx544x4c2656mrz7mjfl9r4xvil-dependencies-input-1.drv
      /my/store/8jlqjyphmv2zj0lprzqpdfp2qwx9kw4f-dependencies-input-2.drv
      /my/store/fz8fi08vhpdch84djnxnyhx7zmm5j73v-dependencies.drv
    error: cloning builder process: Invalid argument
    error: unable to start build process
    + outPath=
running test tests/build-dry.sh... [PASS]
running test tests/build-remote.sh... [FAIL]
    + clearStore
    + echo 'clearing store...'
    clearing store...
    + chmod -R +w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + nix-store --init
    + clearProfiles
    + profiles=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + canUseSandbox
    ++ uname
    + [[ Linux != Linux ]]
    + '[' '!' -L /proc/self/ns/user ']'
    + '[' -e /proc/sys/kernel/unprivileged_userns_clone ']'
    + return 0
    + [[ ! /nix/store/v2hmssglxm87bxg29227zpgjnr2j98vn-bash-4.4-p23/bin/bash =~ /nix/store ]]
    + chmod -R u+w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    + chmod -R u+w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store1
    chmod: cannot access '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store1': No such file or directory
    + true
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0 /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store1
    + nix build -f build-hook.nix -o /tmp/nix-build-nix-2.0.4.drv-0/nix-test/result --max-jobs 0 --sandbox-paths /nix/store --sandbox-build-dir /build-tmp --builders '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0; /tmp/nix-build-nix-2.0
.4.drv-0/nix-test/store1 - - 1 1 foo'
    error: build of '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/2hajs0k3v5nijh8kmph90iqa3npfiycr-build-hook-input-1.drv' on '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store1' failed: unable to start build process
    builder for '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/2hajs0k3v5nijh8kmph90iqa3npfiycr-build-hook-input-1.drv' failed with exit code 1
    cannot build derivation '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/232mzfvzi288jsq5kv58fz9hxq83vw1r-build-hook.drv': 1 dependencies couldn't be built
    error: build of '/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/232mzfvzi288jsq5kv58fz9hxq83vw1r-build-hook.drv' failed
running test tests/nar-access.sh... [PASS]
running test tests/structured-attrs.sh... [PASS]
running test tests/fetchGit.sh... [SKIP]
running test tests/fetchMercurial.sh... [SKIP]
running test tests/signing.sh... [PASS]
running test tests/run.sh... [FAIL]
    + clearStore
    + echo 'clearing store...'
    clearing store...
    + chmod -R +w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + nix-store --init
    + clearProfiles
    + profiles=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + clearCache
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/binary-cache
    + nix run -f run.nix hello -c hello
    + grep 'Hello World'
    Hello World from /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/k960ndvhkk5n02yjic0j3q60vbifybkv-hello/bin/hello
    + nix run -f run.nix hello -c hello NixOS
    + grep 'Hello NixOS'
    Hello NixOS from /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/k960ndvhkk5n02yjic0j3q60vbifybkv-hello/bin/hello
    + canUseSandbox
    ++ uname
    + [[ Linux != Linux ]]
    + '[' '!' -L /proc/self/ns/user ']'
    + '[' -e /proc/sys/kernel/unprivileged_userns_clone ']'
    + return 0
    + chmod -R u+w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0
    + clearStore
    + echo 'clearing store...'
    clearing store...
    + chmod -R +w /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + mkdir /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix
    + nix-store --init
    + clearProfiles
    + profiles=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    + rm -rf /tmp/nix-build-nix-2.0.4.drv-0/nix-test/var/nix/profiles
    ++ nix eval --raw -f run.nix hello
    + path=/tmp/nix-build-nix-2.0.4.drv-0/nix-test/store/k960ndvhkk5n02yjic0j3q60vbifybkv-hello
    + nix run --sandbox-build-dir /build-tmp --sandbox-paths '/nix? /bin? /lib? /lib64? /usr?' --store /tmp/nix-build-nix-2.0.4.drv-0/nix-test/store0 -f run.nix hello -c hello
    + grep 'Hello World'
    error: cloning builder process: Invalid argument
    error: unable to start build process
running test tests/brotli.sh... [PASS]
running test tests/pure-eval.sh... [PASS]
running test tests/check.sh... [PASS]
running test tests/plugins.sh... [PASS]
3 out of 51 tests failed
make: *** [mk/tests.mk:12: installcheck] Error 1
builder for '/nix/store/d9iciyfgp3f8zwchck8lhnac0clmbqj0-nix-2.0.4.drv' failed with exit code 2
cannot build derivation '/nix/store/yalvkynxqpa5lzg119as494mf615vxr9-cabal2nix-2.11.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/r7563bdlpa0w43xxdnds0lmfiiainzb7-cabal2nix-minio-migration.drv': 1 dependencies couldn't be built
error: build of '/nix/store/r7563bdlpa0w43xxdnds0lmfiiainzb7-cabal2nix-minio-migration.drv' failed



Error Building Default Scotty App

Hi, I get the following when trying to build the default app.

NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac.tar.gz time nix-build --no-out-link
make[1]: *** [utils/ghc-cabal/ghc.mk:56: utils/ghc-cabal/dist/build/tmp/ghc-cabal] Killed
make: *** [Makefile:123: all] Error 2
builder for '/nix/store/99vw0012bc3h69858v4iqb8227lwxcax-ghc-8.4.3.drv' failed with exit code 2
cannot build derivation '/nix/store/k0mp0y4dvrxnab3wy214668x93wk5870-example-scotty-app-0.1.0.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/k0mp0y4dvrxnab3wy214668x93wk5870-example-scotty-app-0.1.0.0.drv' failed

I'm using cachix as suggested. Any suggestions?

How to reuse survey?

It would be great to add an example somewhere of how to reuse survey from other projects. What would be the best way though?

Not a nix expert but I think it would be easier to provide such an example if we could:

  • pin nixpkgs via nix instead of using git submodules
  • have that be the default nixpkgs version if the user does not provide another (i.e. do not require NIX_PATH on the command line)
  • actually use the overlays argument

There is an overlays argument in survey but it seems currently unused. Was it maybe supposed to be appended like so?

Trouble compiling pyOpenSSL

Hi there, I gave this a shot again recently in an attempt to build Aura statically. I used to be successful at this, but I think I cleaned out my Nix store recently, blowing away the custom static GHC, etc.

I can get pretty far rebuilding the whole toolchain, but it fails at pyOpenSSL-19.0.0:

builder for '/nix/store/aafcj2cnpqrs4vrlj5i66z1nhr0x20jd-python3.7-pyOpenSSL-19.0.0.drv' failed with exit code 1
cannot build derivation '/nix/store/lwi6hsj50bx87pbqcl0rxx28ywlf0sws-python3.7-urllib3-1.24.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/6v2795g0ixqryzaqkzz261rg5ikfr1jn-python3.7-requests-2.22.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ris2q6l28b7hscqvxp0q72whdyavhp6b-python3.7-sphinx-1.8.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/d817i4fqpv18h39dn0cr2jff7xy2igqr-ghc-8.6.5.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/fb5snsz8xlr46gbfhvgsxcl3yacsjzfh-aura-2.0.3.drv': 1 dependencies couldn't be built
error: build of '/nix/store/fb5snsz8xlr46gbfhvgsxcl3yacsjzfh-aura-2.0.3.drv' failed

I'm trying to build Aura's master branch, using this default.nix:

# Run using:
#
#     $(nix-build --no-link -A fullBuildScript)
{
  stack2nix-output-path ? "custom-stack2nix-output.nix",
}:
let
  cabalPackageName = "aura";
  compiler = "ghc865"; # matching stack.yaml

  # Pin static-haskell-nix version.
  static-haskell-nix =
    if builtins.pathExists ../.in-static-haskell-nix
      then toString ../. # for the case that we're in static-haskell-nix itself, so that CI always builds the latest version.
      # Update this hash to use a different `static-haskell-nix` version:
      else fetchTarball https://github.com/nh2/static-haskell-nix/archive/d24dea3d46a727e1cd93e67458ce2768109efe0a.tar.gz;

  # Pin nixpkgs version
  # By default to the one `static-haskell-nix` provides, but you may also give
  # your own as long as it has the necessary patches, using e.g.
  #     pkgs = import (fetchTarball https://github.com/nh2/nixpkgs/archive/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123.tar.gz) {};
  pkgs = import "${static-haskell-nix}/nixpkgs.nix";

  stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" {
    inherit pkgs;
    stack-project-dir = toString ./.; # where stack.yaml is
    hackageSnapshot = "2020-01-27T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions
  };

  static-stack2nix-builder = import "${static-haskell-nix}/static-stack2nix-builder/default.nix" {
    normalPkgs = pkgs;
    inherit cabalPackageName compiler stack2nix-output-path;
    # disableOptimization = true; # for compile speed
  };

  # Full invocation, including pinning `nix` version itself.
  fullBuildScript = pkgs.writeShellScript "stack2nix-and-build-script.sh" ''
    set -eu -o pipefail
    STACK2NIX_OUTPUT_PATH=$(${stack2nix-script})
    export NIX_PATH=nixpkgs=${pkgs.path}
    ${pkgs.nix}/bin/nix-build --no-link -A static_package --argstr stack2nix-output-path "$STACK2NIX_OUTPUT_PATH" "$@"
  '';

in
  {
    static_package = static-stack2nix-builder.static_package;
    inherit fullBuildScript;
    # For debugging:
    inherit stack2nix-script;
    inherit static-stack2nix-builder;
  }

Please and thanks for any aid you can offer.

coreutils build failure

Here's the minimal reproduction:

let
  nixpkgs =
    builtins.fetchTarball {
      url = "https://github.com/nh2/nixpkgs/archive/a2d7e9b875e8ba7fd15b989cf2d80be4e183dc72.tar.gz";

      sha256 = "1hnmp637r99qd6g0sbx4w3za564gbzwl5c4z0x7fvn7kfi2jp1hx";
    };

  static-haskell-nix =
    builtins.fetchTarball {
      url = "https://github.com/nh2/static-haskell-nix/archive/3a7a54a116b10bee0f6d5c67cfda729e8d22e0a4.tar.gz";

      sha256 = "0zb132nj7wlqnanqqv0c1439y0v2ch823bylnmnmcagxvj4cm2hw";
    };

  pkgsLinux = import nixpkgs {
    system = "x86_64-linux";

    config = {};
  };

  pkgsStaticLinux = import "${static-haskell-nix}/survey" {
    normalPkgs = pkgsLinux;
  };

in
  pkgsStaticLinux.haskellPackages.dhall

This fails with:

$ nix build --file ./example.nix
error: build of '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' on 'ssh://[email protected]' failed: builder for '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' failed with exit code 2
builder for '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' failed with exit code 1; last 10 log lines:
  make[4]: *** [Makefile:12762: tests/test-suite.log] Error 1
  make[4]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make[3]: *** [Makefile:12870: check-TESTS] Error 2
  make[3]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make[2]: *** [Makefile:13125: check-am] Error 2
  make[2]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make[1]: *** [Makefile:12647: check-recursive] Error 1
  make[1]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make: *** [Makefile:13127: check] Error 2
  builder for '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' failed with exit code 2
cannot build derivation '/nix/store/cjvcpa74knvjspg1a275d06j3s9ssq34-dhall-1.19.1.drv': 1 dependencies couldn't be built
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/cjvcpa74knvjspg1a275d06j3s9ssq34-dhall-1.19.1.drv' failed

Can't statically link against `zeromq4-haskell` without modifications

I'm trying to statically link a package against zeromq4-haskell, which is special because it links against libzmq, a C++ library. Based on https://stackoverflow.com/a/37643200 I thought I would only have to add -pgmlg++ to the ghc-options section and stdc++ to the extra-libraries section:

diff --git a/zeromq4-haskell.cabal b/zeromq4-haskell.cabal
index cd4ea53..13e0f82 100644
--- a/zeromq4-haskell.cabal
+++ b/zeromq4-haskell.cabal
@@ -40,7 +40,8 @@ source-repository head
 
 library
     hs-source-dirs:    src
-    ghc-options:       -Wall -O2 -fwarn-tabs -funbox-strict-fields
+    ghc-options:       -Wall -O2 -fwarn-tabs -funbox-strict-fields -pgmlg++
+    extra-libraries: stdc++
 
     exposed-modules:
         Data.Restricted

But this did not seem to work. After asking on IRC, I tried adding -static-libgcc -static-libstdc++ and this didn't work either. Finally @nh2 found that adding -lstdc++ to the final linker invocation resulted in a working binary, and suggested adding -optl-Wl,--start-group -optl-lstdc++ to my ghc-options. This works, but is not ideal because the consumer of the static library has to know to use this flag instead of the library itself. Is there a better way?

A reproduction is available at https://gist.github.com/vaibhavsagar/219af0ae2ca1e4861806f11de2b62c85 (it uses a slightly different approach for building but the problem and solution are the same).

add message to CI that shows what version of nixpkgs is being used to build

I wanted to try to figure out what version (commit) of nixpkgs was used to build https://buildkite.com/nh2/static-haskell-nix/builds/203.

However, it appears that the version is just whatever is the latest version on the channel:

then import (fetchTarball https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz) {}

It would be great if this version was output in the buildkite log somehow, so that I could try to reproduce this build locally.

I'm not sure what would be the best way to output the commit. Maybe a builtins.trace message in the nixpkgs.nix file? That should show up in the buildkite log.

Simple project build fails due to `callCabal2nix` being a function, not a set

Can't build a simple project due to callCabal2nix being a function and not a derivation.

I'm using commit: 9781df8a48eade302d159ce63a7ab0c30247788c from 1st of March 2019

Trying to build fails on this error:

error: while evaluating the attribute 'callCabal2nix' at /nix/store/5nj7vgd7spdcvxs47gpv58nqjs76vsla-source/lib/attrsets.nix:200:46:
while evaluating anonymous function at /.../static-haskell-nix/survey/default.nix:680:25, called from /nix/store/5nj7vgd7spdcvxs47gpv58nqjs76vsla-source/lib/attrsets.nix:200:54:
while evaluating 'isExecutable' at /.../static-haskell-nix/survey/default.nix:58:18, called from /home/talw/code/static-haskell-nix/survey/default.nix:681:10:
while evaluating 'overrideCabal' at /nix/store/5nj7vgd7spdcvxs47gpv58nqjs76vsla-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /home/talw/code/static-haskell-nix/survey/default.nix:59:6:
value is a function while a set was expected, at /nix/store/5nj7vgd7spdcvxs47gpv58nqjs76vsla-source/pkgs/development/haskell-modules/lib.nix:37:28

Looking in survey/default.nix I found:

  haskellPackages =
    lib.mapAttrs (name: value:
      if isExecutable value then statify value else value
    ) haskellPackagesWithLibsReadyForStaticLinking;

The error was that isExecutable expects to get a set but got a function.
So I traced to see on which name it happens:

  haskellPackages =
    lib.mapAttrs (name: value:
      if isExecutable (builtins.trace name value) then statify value else value
    ) haskellPackagesWithLibsReadyForStaticLinking;

And found it to be: trace: callCabal2nix

The following changed circumvented the error, but I'm not sure why this
happens of what is the correct solution:

  haskellPackages =
    lib.mapAttrs (name: value:
      if name != "callCabal2nix" && isExecutable value then statify value else value
    ) haskellPackagesWithLibsReadyForStaticLinking;

Note that I passed to survey the exact same nixpkgs as did the static_stack
example so no surprises there.

  nixpkgsForStatic = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/88ae8f7d55efa457c95187011eb410d097108445.tar.gz) {};

  staticPkgs = (survey {
    normalPkgs = nixpkgsForStatic;
    overlays = [pyopenssl-fix-test-buffer-size-overlay];
  }).pkgs;

  staticHaskPkgs = (survey {
    normalPkgs = staticPkgs;
  }).haskellPackages;

  staticDrv = staticHaskPkgs.callCabal2nix "experiment" ./. {};

I wonder if this problem is replicated for other people.

postgrest project stack build error GHC: ld-linux-x86-64.so.2: No such file or directory

this is my procedure for build stack project: postgrest, but it failed finally:
BTW, what's the best way to build stackage project?

export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d55efa457c95187011eb410d097108445.tar.gz

$(nix-build --no-out-link -A stack2nix-script) ~/my-repo/postgrest

[larluo@nixos-larluo:~/my-repo/static-haskell-nix/static-stack2nix-builder]$ $(nix-build --no-out-link -A static-build-script)
+ /nix/store/ilf1nd7xvfska20pc7x8pslr7mw7lm2v-nix-2.0.4/bin/nix-build --no-out-link -A static_package
error: attribute 'myproject' missing, at /home/larluo/my-repo/static-haskell-nix/static-stack2nix-builder/default.nix:64:20
(use '--show-trace' to show detailed location information)

cabal2nix evaluation failures

Here's the reproduction:

let
  compiler = "ghc865";

  nixpkgs = builtins.fetchTarball {
    url    = "https://github.com/nh2/nixpkgs/archive/11aa987ea5b5a593c9ca7a38b391804959f905e5.tar.gz";
    sha256 = "1wns6051fxpgmszyxjvk7020zzhljjxqxkrnqmyd3b6fah7q4vny";
  };

  static-haskell-nix = builtins.fetchTarball {
    url    = "https://github.com/nh2/static-haskell-nix/archive/d24dea3d46a727e1cd93e67458ce2768109efe0a.tar.gz";

    sha256 = "0ri4r77md77kmbqmx0j3h0paj538zpq4hki7vy8ycpwssm2xd442";
  };

  overlay = pkgsNew: pkgsOld: {
    haskell = pkgsOld.haskell // {
      packages = pkgsOld.haskell.packages // {
        "${compiler}" = pkgsOld.haskell.packages."${compiler}".override (old: {
            overrides = pkgsNew.haskell.lib.packageSourceOverrides {
              dhall = "1.27";
            };
          }
        );
      };
    };
  };

  normalPkgs = import nixpkgs {
    system = "x86_64-linux";

    config = { };

    overlays = [ overlay ];
  };

  staticHaskell = import "${static-haskell-nix}/survey/default.nix" {
    inherit compiler normalPkgs;
  };

in
  staticHaskell.all.dhall

Here's the evaluation failure:

$ nix build --file ./minimal.nix --show-trace
error: while evaluating the file '/root/dhall-haskell/minimal.nix':
while evaluating the attribute 'all.dhall' at /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:1263:32:
while evaluating the attribute 'dhall' at undefined position:
while evaluating anonymous function at /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:1245:35, called from undefined position:
while evaluating 'isProperHaskellPackage' at /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:84:28, called from /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:1246:15:
while evaluating 'isDerivation' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/attrsets.nix:305:18, called from /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:85:5:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:48:54, called from undefined position:
while evaluating 'callPackageKeepDeriver' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:157:33, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:53:10:
while evaluating 'overrideCabal' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:158:5:
while evaluating 'callPackage' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:114:22, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:158:20:
while evaluating 'callPackageWithScope' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:74:37, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:114:28:
while evaluating 'makeOverridable' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:67:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:97:8:
while evaluating 'drvScope' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:87:18, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:69:12:
while evaluating the attribute 'nativeBuildInputs' of the derivation 'cabal2nix-dhall-1.27' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:126:7:
while evaluating 'getOutput' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/attrsets.nix:464:23, called from undefined position:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/stdenv/generic/make-derivation.nix:133:17, called from undefined position:
while evaluating the attribute 'cabal2nix' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:1262:3:
while evaluating 'overrideCabal' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:1262:15:
while evaluating 'override' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:73:20, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:37:28:
while evaluating 'makeOverridable' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:67:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:73:29:
while evaluating 'drvScope' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:87:18, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:69:12:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/hackage-packages.nix:45954:6, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/make-package-set.nix:87:27:
while evaluating 'mkDerivation' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:38:20, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/hackage-packages.nix:45960:6:
while evaluating 'override' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:73:20, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/lib.nix:38:25:
while evaluating 'makeOverridable' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:67:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:73:29:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/generic-builder.nix:12:1, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:69:12:
while evaluating 'fix' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/fixed-points.nix:19:9, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/generic-builder.nix:240:4:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/generic-builder.nix:240:20, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/fixed-points.nix:19:20:
while evaluating 'optionalAttrs' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/attrsets.nix:331:25, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/development/haskell-modules/generic-builder.nix:511:4:
while evaluating the attribute 'configureFlags' of the derivation 'nix-2.3.1' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/tools/package-management/nix/default.nix:28:14:
while evaluating the attribute 'configurePhase' of the derivation 'busybox-1.30.1-x86_64-unknown-linux-musl' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'cc.targetPrefix' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/stdenv/generic/default.nix:148:14:
while evaluating the attribute 'gcc' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:7605:3:
while evaluating 'addMetaAttrs' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/meta.nix:15:28, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:7765:10:
while evaluating 'wrapCC' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:8625:12, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:7765:19:
while evaluating 'wrapCCWith' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:8604:5, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:8625:16:
while evaluating 'callPackageWith' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:108:35, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/top-level/all-packages.nix:8613:7:
while evaluating 'makeOverridable' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:67:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:112:8:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/build-support/cc-wrapper/default.nix:8:1, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:69:12:
while evaluating the attribute 'patches' of the derivation 'musl-1.1.22-x86_64-unknown-linux-musl' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'nativeBuildInputs' of the derivation '300-relative.patch' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/build-support/fetchurl/default.nix:119:3:
while evaluating 'getOutput' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/attrsets.nix:464:23, called from undefined position:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/stdenv/generic/make-derivation.nix:133:17, called from undefined position:
while evaluating 'override' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:73:20, called from /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:697:14:
while evaluating 'makeOverridable' at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:67:24, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:73:29:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:77:28, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:69:12:
while evaluating anonymous function at /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/pkgs/tools/networking/curl/default.nix:1:1, called from /nix/store/7fjx5cza1ijdf6bsnchqn8g5zd0hza33-source/lib/customisation.nix:77:35:
while evaluating 'statify_zlib' at /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:459:18, called from /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:697:41:
attribute 'override' missing, at /nix/store/2yha1cvdl0d3l9p8zv00qhnbrkfx41fr-source/survey/default.nix:460:6

I believe this is not the same thing as #9 since that is a build failure whereas this is an evaluation failure.

Document example failure of glibc static linking with NSS somewhere

I got this example segfault of somebody trying to use an executable statically linked with glibc and using the network.

The stacktrace is of the program crashing in gdb; stack build ... --no-strip was used to obtain a sensible stack trace, otherwise it would show just in ?? () in the entire trace.

Thread 11 "myprogram:w" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 494]
0x00007ffff43857a0 in internal_getent (stream=stream@entry=0x7ffff4059680, result=result@entry=0x368b1a0 <resbuf.11135>, buffer=buffer@entry=0x36e7a20 "# Internet (IP) protocols\n", buflen=buflen@entry=1024, errnop=errnop@entry=0x7fffe67fc6a0)
    at nss_files/files-XXX.c:216
216    nss_files/files-XXX.c: No such file or directory.
(gdb) bt
#0  0x00007ffff43857a0 in internal_getent (stream=stream@entry=0x7ffff4059680, result=result@entry=0x368b1a0 <resbuf.11135>, buffer=buffer@entry=0x36e7a20 "# Internet (IP) protocols\n", buflen=buflen@entry=1024, errnop=errnop@entry=0x7fffe67fc6a0)
    at nss_files/files-XXX.c:216
#1  0x00007ffff4385a32 in _nss_files_getprotobyname_r (name=0x420021c800 "tcp", result=0x368b1a0 <resbuf.11135>, buffer=0x36e7a20 "# Internet (IP) protocols\n", buflen=1024, errnop=0x7fffe67fc6a0) at nss_files/files-proto.c:38
#2  0x0000000003026f47 in getprotobyname_r ()
#3  0x0000000003026d18 in getprotobyname ()
#4  0x0000000002208aee in ?? ()
#5  0x0000000000000000 in ?? ()

Should probably document that somewhere as an example for why you may want to use musl here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.