Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell Stack project setup fails at getProtocolByName #19526

Closed
vklquevs opened this issue Oct 13, 2016 · 2 comments
Closed

Haskell Stack project setup fails at getProtocolByName #19526

vklquevs opened this issue Oct 13, 2016 · 2 comments

Comments

@vklquevs
Copy link
Contributor

Issue description

(ConnectionFailure getProtocolByName: does not exist (no such protocol name: tcp))

I have been trying to build a Stack project with a Nix shell but it fails with the above error. There are other issues (#18038, #15168) matching these symptoms, but they are using Docker. It looks like stack is unable to find /etc/protocols from within the shell, but I can't figure out why or how to fix it.

I appreciate I may be doing something entirely wrong with these Nix files, and have mostly been guessing from what I've read about Stack/Nix integration.

Full output for nix-build shell.nix:

derivations will be built:
  /nix/store/bym9a09d256q7idj8nw1df87f0m90phw-stack-test-project.drv
  /nix/store/04i3r3shlszzl541ynm5k0pbjcr3m5xj-stack-test.drv
building path(s) ‘/nix/store/qkczba1fh57jcsykk6g1ahfjy39mx77i-stack-test-project’
unpacking sources
unpacking source archive /nix/store/ixhfwb2r15rwj0l4c830dbj0rwgraqcm-test
source root is test
patching sources
configuring
Downloading lts-6.21 build plan ...
HttpExceptionRequest Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/fpco/lts-haskell/master//lts-6.21.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure getProtocolByName: does not exist (no such protocol name: tcp))
builder for ‘/nix/store/bym9a09d256q7idj8nw1df87f0m90phw-stack-test-project.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/04i3r3shlszzl541ynm5k0pbjcr3m5xj-stack-test.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/04i3r3shlszzl541ynm5k0pbjcr3m5xj-stack-test.drv’ failed

Steps to reproduce

shell.nix

with import <nixpkgs> {};
runCommand "stack-test" {
  buildInputs = [
    (pkgs.haskellPackages.callPackage ./stack.nix {})
  ];
} ""

stack.nix

{ghc}:
with import <nixpkgs> {};
haskell.lib.buildStackProject {
    inherit ghc;
    name = "stack-test-project";
    buildInputs = [
        stack
    ];
    src = ./.;
}

stack.yaml

resolver: lts-6.21
packages:
- '.'
nix:
    enable: true

Technical details

  • System: 16.09.741.354fd37 (Flounder)
  • Nix version: nix-env (Nix) 1.11.4
  • Nixpkgs version: 16.09.741.354fd37
@peti
Copy link
Member

peti commented Nov 2, 2016

shell.nix tries to add a compiled version of the project you're developing into your development environment, i.e. you're compiling the entire project within Nix. Nix builds, however, don't have access to the name server. Thus, your build fails complaining about the absence of /etc/services.

@vklquevs
Copy link
Contributor Author

vklquevs commented Nov 2, 2016

Ah, gotcha. Thanks; what I should be doing, then, is treating the haskell part as a normal Nix package (I've got the output of cabal2nix as a starting point) and building it as usual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants