Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

Switch to haskell.nix #19

Closed
infinisil opened this issue Aug 19, 2019 · 18 comments
Closed

Switch to haskell.nix #19

infinisil opened this issue Aug 19, 2019 · 18 comments

Comments

@infinisil
Copy link
Owner

input-output-hk/stack2nix#140 (comment)

@infinisil
Copy link
Owner Author

Another really neat thing might be to try get a static build going with https://github.com/nh2/static-haskell-nix, not sure how well that's compatible with haskell.nix though

@infinisil
Copy link
Owner Author

The advantage of this is that there's no more long-ass stack2nix step to generate the Nix files. However the disadvantage is that it takes about twice as long (2 seconds for a single HIE version in comparison to 1 second with stack2nix) to instantiate the derivation.

@infinisil infinisil mentioned this issue Mar 13, 2020
@poscat0x04
Copy link

poscat0x04 commented Mar 13, 2020

I tried to build hie ghc-8.6.5 using stack-to-nix. It failed with

Error:
    The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used.
installed package ghc-8.6.5 is broken due to missing package terminfo-0.4.1.2

I suspect there's a broken package upstream.

@expipiplus1
Copy link
Contributor

What are the consequences of using a haskell.nix compiled HIE with a nixpkgs provisioned haskell development shell (and vice-versa)? Will it all just work as long as the GHC version numbers are the same?

@expipiplus1
Copy link
Contributor

Seems to work fine

@expipiplus1
Copy link
Contributor

expipiplus1 commented Apr 2, 2020

This seems to work (in the hie directory)
https://gist.github.com/4ebbfeb4f951641c81a4c89683d8d385

@expipiplus1
Copy link
Contributor

There is a concerning bug when using hie-bios (and hence hie itself) when compiled with haskell.nix: input-output-hk/haskell.nix#553

The short is: any TH which uses the types returned by reify is likely to be broken.

@infinisil
Copy link
Owner Author

See #52 (comment), where I explained why haskell.nix probably won't work for all-hies after all. I guess I should just close this.

@infinisil
Copy link
Owner Author

Hm, on the other hand, maybe the best solution is to just use haskell.nix and drop support for GHC versions it doesn't support.

@infinisil infinisil reopened this May 1, 2020
@infinisil
Copy link
Owner Author

I've started looking further into haskell.nix, fixing some problems along the way to make it go smoothly, see haskell/haskell-ide-engine#1770 and input-output-hk/nix-tools#90.

It also looks like haskell.nix now supports almost all versions that HIE supports (the only two versions it doesn't are 8.4.2 and 8.4.3, which I'd be totally fine with dropping support for)

I'll continue working on this, seems very promising.

@infinisil
Copy link
Owner Author

So the haskell.nix branch is here, and GHC 8.6.5 and 8.8.3 build just fine (e.g. with nix-build -A builds.ghc865), but the other versions not so much. E.g. 8.8.2 doesn't build because of input-output-hk/haskell.nix#481. I wouldn't mind some help with that. If I can't get it working I'll just have to drop support for other versions, which would make this more of a "some-hies" than "all-hies" :/

@drchaos
Copy link

drchaos commented May 20, 2020

I've tried to build HIE with support of ghc865 and ghc883 on haskell.nix branch

nix-env -iA selection --arg selector 'p: { inherit (p) ghc865 ghc883; }' -f https://github.com/infinisil/all-hies/tarball/haskell.nix --show-trace

and got this error

replacing old 'haskell-ide-engine-combined'
installing 'haskell-ide-engine-combined-1.4'
building '/nix/store/9yfhcam96hg0aywim2lnv1bd831svs9j-source.drv'...
building '/nix/store/ja1z9gb7jbcwhixxzj3zvwa24d5vlh32-ghc-8.4.4-x86_64-deb8-linux.tar.xz.drv'...

trying https://github.com/haskell/haskell-ide-engine/tarball/1.4
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0   1104      0 --:--:-- --:--:-- --:--:--  1095

trying https://haskell.org/ghc/dist/8.4.4/ghc-8.4.4-x86_64-deb8-linux.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   359  100   359    0     0    330      0  0:00:01  0:00:01 --:--:--   330
100  791k    0  791k    0     0   577k      0 --:--:--  0:00:01 --:--:-- 1946k
unpacking source archive /tmp/nix-build-source.drv-0/1.4
do not know how to unpack source archive /tmp/nix-build-source.drv-0/1.4
builder for '/nix/store/9yfhcam96hg0aywim2lnv1bd831svs9j-source.drv' failed with exit code 1
cannot build derivation '/nix/store/7373mb270dhy8vshiqamb4v9mjrawdb4-haskell-ide-engine-patched.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/q1w025zayjvijw0rgmkspkca4wprv0aj-stack-repos.drv': 1 dependencies couldn't be built
error: while evaluating 'assertValidity' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:247:20, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:278:18:
while evaluating 'checkValidity' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:228:19, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:248:18:
while evaluating 'hasDeniedUnfreeLicense' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:64:28, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:229:8:
while evaluating 'hasLicense' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:35:16, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/pkgs/stdenv/generic/check-meta.nix:66:5:
while evaluating the attribute 'packages.hie' at /nix/store/axzy3h695csaq9b99kzj5x2h89arj1y1-haskell.nix/build.nix:106:11:
while evaluating the attribute 'hsPkgs.haskell-ide-engine.components.exes' at /nix/store/4p74s0h0z1w3bpm7z3qqwi33rkds73vv-source/overlays/haskell.nix:494:42:
while evaluating the attribute 'hsPkgs' at undefined position:
while evaluatingnonymous function at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:84:45, called from undefined position:
while evaluating the attribute 'value' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:379:9:
while evaluating the option `hsPkgs':
while evaluating the attribute 'mergedValue' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:411:5:
while evaluating the attribute 'values' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:405:9:
while evaluating the attribute 'values' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:505:7:
while evaluating anonymous function at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:391:28, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:391:17:
while evaluating 'dischargeProperties' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:464:25, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:392:62:
while evaluating the attribute 'value' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:277:44:
while evaluating the attribute 'packages' at undefined position:
while evaluating anonymous function at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:84:45, called from undefined position:
while evaluating the attribute 'value' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:379:9:
while evaluating the option `packages':
while evaluating the attribute 'mergedValue' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:411:5:
while evaluating the attribute 'values' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:405:9:
while evaluating the attribute 'values' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:505:7:
while evaluating anonymous function at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:391:28, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:391:17:
while evaluating 'dischargeProperties' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:464:25, called from /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:392:62:
while evaluating the attribute 'value' at /nix/store/rkamf4cwqf8hbzr3sd7sq3x4qdzs6m3j-nixpkgs/lib/modules.nix:277:44:
while evaluating anonymous function at /nix/store/4p74s0h0z1w3bpm7z3qqwi33rkds73vv-source/lib/stack-cache-generator.nix:4:1, called from /nix/store/4p74s0h0z1w3bpm7z3qqwi33rkds73vv-source/overlays/haskell.nix:482:34:
build of '/nix/store/q1w025zayjvijw0rgmkspkca4wprv0aj-stack-repos.drv' failed a

Maybe I've done smth wrong?

@infinisil
Copy link
Owner Author

Ah, I've been using the iohk cachix to avoid having to build the bootstrapping stuff. Once I know that the haskell.nix derivations are working, I'll push the builds to the all-hies cachix. For now you can use

$ cachix use iohk

to avoid most of the building (though it's still a lot even with that)

@drchaos
Copy link

drchaos commented May 21, 2020

No changes. It stops on unpacking sources of stack-repos.

@meck
Copy link

meck commented May 21, 2020

I get the same error as @drchaos when trying this branch.

@infinisil
Copy link
Owner Author

Ahh that was my mistake after all (I didn't look too closely at the error), I pushed a fix now. (The iohk cachix is still recommended though)

@drchaos
Copy link

drchaos commented May 22, 2020

@infinisil It works now! Thanks.

@infinisil
Copy link
Owner Author

Now done with #64

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

No branches or pull requests

5 participants