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

nix develop throughs error #653

Open
dschrempf opened this issue Nov 15, 2022 · 9 comments
Open

nix develop throughs error #653

dschrempf opened this issue Nov 15, 2022 · 9 comments

Comments

@dschrempf
Copy link

dschrempf commented Nov 15, 2022

Hi! Thanks a lot for working on hasktorch, it looks like we do have a nice machine learning library in Haskell!

When building hasktorch using nix develop I had the following problems:

  • Even with substituters and public keys properly set up, more than 1000 Haskell packages have to be built (not GHC, so the caches do work at least somewhat).

  • After buliding the roughly 1000 packages, the following error is thrown:

error: derivation '/nix/store/c40s2l737pwr1b38j7agnvalgsdvs727-hoogle-with-packages.drv' requires non-existent output 'doc' from input derivation '/nix/store/0hx10c9mz48fz6d7i4dnqvk66imz79ya-vector-sized-lib-vector-sized-1.5.0-haddock.drv'

(I noticed this weird package naming name-lib-name-version. Is this specific to haskell.nix?)

  • Finally, I think there is some legacy Nix code: haskell-nix.custom-tools.haskell-language-server seems to be set to version 1.5.0.0, which was released in November 2021.

Thanks for your help!

@junjihashimoto
Copy link
Member

junjihashimoto commented Nov 16, 2022

Hi, thank you for letting me know!
I think you don't need to build the haddock. It is for uploading haddocks to https://github.com/hasktorch/hasktorch.github.io.
You can comment out it.
https://github.com/hasktorch/hasktorch/blob/master/flake.nix#L141-L150
However, I don't know why haddock throws the errors, because the build works with my environment(ubuntu).

For now, haskell-language-server is not cached, and haskell-language-server should be cached in cachix.hasktorch.org.
It would be nice to build it on CI of hasktorch.

@dschrempf
Copy link
Author

I am still not succeeding in building hasktorch. Even when deactivating the haddock part mentioned above, GHC 8.4.4 is built and I can not find out why. It must be when executing the IFD, because it is already built when executing nix show-derivation .#devShell.x86_64-linux.

When asking around on the Nix Haskell Matrix channel, I also got the comment that hasktorch follows the "pre nix2.8 approach" which is deprecated, and that "The flake should migrate to use devShells.$system.default instead". I'd be happy to file a PR, but first I need to be able to build the project.

@dschrempf
Copy link
Author

I just checked, and it is not surprising that GHC8.4.4 is built because it is not anymore cached by IOHK: https://input-output-hk.github.io/haskell.nix/reference/supported-ghc-versions.html. The question is, why is GHC844 needed?

@junjihashimoto
Copy link
Member

junjihashimoto commented Dec 1, 2022

I think GHC-8.4.4 is needed to build other ghc. It might be ghc-8.10.
We need ghc-9.2 for each architecture, but I think the problem is that it's not cached.

@junjihashimoto
Copy link
Member

junjihashimoto commented Dec 1, 2022

In the first place, I want to use ghc of nixpkgs directly, because ghc is built every time when the version is upgraded.
Since ghc is not cached, the packages of the ghc are also not cached, so there is not much advantage of using nix.
stacklock2nix might be better than haskell.nix.
https://github.com/cdepillabout/stacklock2nix

@junjihashimoto
Copy link
Member

For now, I expect that hls can be cached with this PR.
#655

@dschrempf
Copy link
Author

Hi! Thanks for looking into this. I am still not having any luck. Cloning

commit 4f7f8acb71de08d81a349ba9b36ce2f10fdbd389 (HEAD -> master, origin/master, origin/HEAD)
Author: Junji Hashimoto <junji.hashimoto@gmail.com>
Date:   Mon Dec 19 10:02:15 2022 +0900

    Revert x86_64-darwin of flake.nix

and executing nix develop on x86_64-linux starts compilation of over 800 packages. I double checked, the cache is set up properly!

@junjihashimoto
Copy link
Member

I've tried stacklock2nix.
The compilation of ghc is nothing.
https://github.com/hasktorch/hasktorch/tree/feature/stacklock2nix

@junjihashimoto
Copy link
Member


haskell.nix reduces the depth of bootstrap. input-output-hk/haskell.nix#1854
But, originally it was 3 tiers, but now it's only 2 tiers, and it's not resolved.

The attempts to use nixpkgs's compiler failed with this branch(https://github.com/hasktorch/hasktorch/blob/feat/haskell-nix-ghc-nixpkgs/flake.nix#L63-L79). This branch does not work with the latest haskell.nix(2023/8/16 1970bb2d5b0eb8152f89b305f32d055dbd6857d9).

Haskell.nix is better than stacklock2nix due to the number of maintainers, but I'll go with stacklock2nix.

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

No branches or pull requests

2 participants