Chris Stryczynski

Software Developer / Consultant

How to NOT build a stack project with nix

Posted on: 29/05/2019

Nix’s pkgs.haskell.lib.buildStackProject is probably broken or just really annoying…

nix-build default.nix.backup 
these derivations will be built:
  /nix/store/9797fl2r6rinw1mb7b8ayi6jxj3a7l1r-app.drv
building '/nix/store/9797fl2r6rinw1mb7b8ayi6jxj3a7l1r-app.drv'...
unpacking sources
unpacking source archive /nix/store/q481gqrxwra22i3nhidvx59l9pcf0yw4-app.zip
unpacker produced multiple directories
builder for '/nix/store/9797fl2r6rinw1mb7b8ayi6jxj3a7l1r-app.drv' failed with exit code 1
error: build of '/nix/store/9797fl2r6rinw1mb7b8ayi6jxj3a7l1r-app.drv' failed

Apparently the issue is unpacker produced multiple directories - yes that is an error?

  1. What is going on?!?!
nix-build                        
these derivations will be built:
  /nix/store/f7q25p7gb7w3zykvz1fdj54yk2hzg2ka-app.drv
building '/nix/store/f7q25p7gb7w3zykvz1fdj54yk2hzg2ka-app.drv'...
unpacking sources
unpacking source archive /nix/store/6xhr70laphybavd06bcm14nii5pni3bs-SodiumSierraStrawberry
source root is SodiumSierraStrawberry
patching sources
configuring
no configure script, doing nothing
building
Downloading lts-13.8 build plan ...
RedownloadHttpError (HttpExceptionRequest Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("User-Agent","The Haskell Stack")]
  path                 = "/fpco/lts-haskell/master//lts-13.8.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure Network.BSD.getProtocolByName: does not exist (no such protocol name: tcp)))
builder for '/nix/store/f7q25p7gb7w3zykvz1fdj54yk2hzg2ka-app.drv' failed with exit code 1
error: build of '/nix/store/f7q25p7gb7w3zykvz1fdj54yk2hzg2ka-app.drv' failed
  1. It needs network access and we need to build it in a non sandbox way:
nix-build --option sandbox false 
these derivations will be built:
  /nix/store/9svklmcrsjn159597d768hsn5v2lnalf-app.drv
building '/nix/store/9svklmcrsjn159597d768hsn5v2lnalf-app.drv'...
unpacking sources
unpacking source archive /nix/store/1dm0sy5jpdwnhpq85iirwjhjxyhmldn5-SodiumSierraStrawberry
source root is SodiumSierraStrawberry
patching sources
configuring
no configure script, doing nothing
building
Downloading lts-13.8 build plan ...
Downloaded lts-13.8 build plan.
I don't know how to install GHC on your system configuration, please install manually
builder for '/nix/store/9svklmcrsjn159597d768hsn5v2lnalf-app.drv' failed with exit code 1
error: build of '/nix/store/9svklmcrsjn159597d768hsn5v2lnalf-app.drv' failed

……

So I’ll probably have to say goodbye to stack for now. It also has issues with Nix in general otherwise (packages that have previously built, no longer build..): https://github.com/NixOS/nixpkgs/issues/59132


Update: So the particular error regarding GHC seems to be discussed here: https://github.com/commercialhaskell/stack/issues/4539

Comments

No comments, yet!

Submit a comment