turion / essence-of-live-coding-tutorial

Tutorial for essence-of-live-coding
BSD 3-Clause "New" or "Revised" License
16 stars 4 forks source link

nix-shell fails with missing dependency error #10

Closed peterstuart closed 4 years ago

peterstuart commented 4 years ago

I get the following error when I run nix-shell:

Setup: Encountered missing or private dependencies:
network <2.9

builder for '/nix/store/dpsa1jjnwnk8g6r66xrh14vmj038wyzs-hslogger-1.2.12.drv' failed with exit code 1
cannot build derivation '/nix/store/bsk20fmn01avpnwnxs0qc2b85ka2z735-ghcide-0.1.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/arc919p4pzw34l196853rdallhvi0iwp-cabal-install-3.0.0.0.drv', '/nix/store/bsk20fmn01avpnwnxs0qc2b85ka2z735-ghcide-0.1.0.drv', '/nix/store/h18500qpqhdn1q1k9225lhwxrm3p8wx1-ghc-8.8.3-with-packages.drv', '/nix/store/hf3d0lc6dcc6v23vx6zxkbli87q8plyd-ghcid-0.7.7.drv', '/nix/store/wxl096y5m3ic9m8jzamhc4g4x7zha3j2-hlint-2.2.10.drv' failed

This is on NixOS, if that makes a difference.

turion commented 4 years ago

Thanks for the report. I'm a bit surprised. Maybe your nixpkgs is out of date? Can you run nix-channel --update? (Possibly as root)

I could also try and pin a particular nixpkgs version. I'll do that later if I can and let you know.

turion commented 4 years ago

@peterstuart I think #11 should fix this, if you can give it a try.

peterstuart commented 4 years ago

I ran nix-channel --update, but got the same error. I see the same error on your PR branch, too:

CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1022:20 in Cabal-3.0.1.0:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:475:12 in Cabal-3.0.1.0:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:625:20 in Cabal-3.0.1.0:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:65:5 in Cabal-3.0.1.0:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:180:19 in Cabal-3.0.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:116:27 in Cabal-3.0.1.0:Distribution.Simple
  defaultMain, called at Setup.hs:5:8 in main:Main
Setup: Encountered missing or private dependencies:
network <2.9

builder for '/nix/store/dpsa1jjnwnk8g6r66xrh14vmj038wyzs-hslogger-1.2.12.drv' failed with exit code 1
cannot build derivation '/nix/store/bsk20fmn01avpnwnxs0qc2b85ka2z735-ghcide-0.1.0.drv': 1 dependencies couldn't be built
building '/nix/store/1pqsahqxznzdi55d353180za3p5kmnj3-iproute-1.7.8.drv'...
building '/nix/store/4dhdr0np3x3647vmz72y4f235pf4l12i-simple-sendfile-0.2.30.drv'...
building '/nix/store/g5ljg1jdscyawiiw3g8ay644pl8kwdkz-streaming-commons-0.2.1.2.drv'...
building '/nix/store/dlgvrm19jvlmj8jn00rcg9jhbv6a4rmc-tasty-th-0.1.7.drv'...
building '/nix/store/gl1yw9az44np1anqrh9i26l2nahm094g-test-framework-th-0.2.4.drv'...
building '/nix/store/a3f6smqshvxsl8grk938wp6zzjy6zk56-time-compat-1.9.2.2.drv'...
building '/nix/store/0cw13bf7maik2zxqn9zyp4866r479xrc-transformers-base-0.4.5.2.drv'...
building '/nix/store/1xf4p6bjpavw7668xmji36sl709c9gfn-unliftio-0.2.12.drv'...
cannot build derivation '/nix/store/vk00d5h441nhg5c94r8hah9fii5kx3lk-lorri-keep-env-hack-ghc-shell-for-essence-of-live-coding-tutorial-0.2.3-0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/vk00d5h441nhg5c94r8hah9fii5kx3lk-lorri-keep-env-hack-ghc-shell-for-essence-of-live-coding-tutorial-0.2.3-0.drv' failed

Thanks for looking into this! I haven't done Haskell development with Nix before, so I can't be much help.

turion commented 4 years ago

@peterstuart I've looked into this a bit now, and the problem is indeed using a too old nixpkgs. Can you post nix-channel --list?

What I don't understand is why it doesn't work on that branch. Can you post the first few lines of mypkgs.nix? Probably I had some outdated commit on that branch, and I since pushed an updated version. Maybe you need to git checkout dev_nix2 && git fetch && git reset --hard origin/dev_nix2.

peterstuart commented 4 years ago
$ nix-channel --list
unstable https://nixos.org/channels/nixpkgs-unstable

mypkgs.nix:

{ compiler ? "ghc883"
# , nixpkgs ? import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs-channels/archive/c59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38.tar.gz") {}
# If you have a nix-channel installed locally which you want to use, uncomment and possibly edit the following line, and comment the line above.
# , nixpkgs ? import <nixpkgs> {}
# Yet another possibility is uncommenting the next line, which will give you the latest stable release of nixpkgs. But you'll add a further change down, with http-client.
, nixpkgs ? import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs-channels/archive/b83b54d0a8336746e4cd130bb7beb2ddd032ac87.tar.gz") {}
}:

I am on NixOS 20.03, so I did have to make the http-client change that you left a comment about in mypkgs.nix.

turion commented 4 years ago

@peterstuart Ah ok. Yes, I can reproduce that this doesn't work. 20.03 is too old. But that doesn't matter. In a nix-shell, you can have a different version. Can you revert your changes and uncomment the first commented line? That should work.

It might take a long time, but if you have cachix installed (or if you want to install it), you can save time by first executing cachix use manuelbaerenz.

peterstuart commented 4 years ago

That works, thanks!