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

Package builds with stack, doesn't build with haskell.nix #2186

Open
zmrocze opened this issue Apr 24, 2024 · 2 comments
Open

Package builds with stack, doesn't build with haskell.nix #2186

zmrocze opened this issue Apr 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@zmrocze
Copy link

zmrocze commented Apr 24, 2024

This template is a guide only, feel free add or omit sections as appropriate.

Describe the bug

Using:

Haskell source code version locked at:

  1. https://github.com/zmrocze/agda-language-server/tree/c2ae939fcc041bcb1e4a5f1f8bacc88434f49d16

Haskell.nix, system, ghc versions locked at:

  1. https://github.com/zmrocze/agda-language-server.nix/tree/4a8d0beca0c734d2692c4887858ae3438a6ce072

I want to build the package from 1. with haskell.nix. I take it as input in the flake 2. and build it in the most usual way with haskell.nix, see 2..
Running stack build in 1. succeeds but haskell.nix build fails.

Steps To Reproduce

Run

nix build github:zmrocze/agda-language-server.nix\?ref=4a8d0beca0c734d2692c4887858ae3438a6ce072

and observe fail to build, by a failing build of a dependency. You will see something like:

       > buildPhase completed in 5 minutes 46 seconds
       > installing
       > Installing library in /nix/store/c92cq2aa91l26bkr5glkmvfa5qarbdkn-Agda-lib-Agda-2.6.4/lib/x86_64-linux-ghc-9.2.8/Agda-2.6.4-2s4UofYjycP5wyQEx5u0zH
       > Generating Agda library interface files...
       > dist/build/agda/agda: readCreateProcess: posix_spawnp: does not exist (No such file or directory)
       For full logs, run 'nix log /nix/store/n8f4izzq2g7h3vw9df8nrnm57ckq0syw-Agda-lib-Agda-2.6.4.drv'.
error: 1 dependencies of derivation '/nix/store/xa55k3cialzwcql68cz0bzh084fwjgk7-agda-language-server-exe-als-0.2.6.4.0.3.drv' failed to build

Now go to repository 1. The package there builds with stack but it needs some packages in path when building the final package "agda-language-server". Therefore I provide shell.nix and instruct stack to use these deps with nix: ... lines in stack.yaml.
Enter the nix shell and run stack build: nix-shell -c "stack build". The build succeeds.

The dependency on agda-lib-agda which fails when building with haskell.nix, builds with stack or is provided from snapshot. Therefore haskell.nix does something incompatible with to stack build.

Important: Note that eventhough for the stack build to succeed I need the nix shell - The haskell.nix fails earlier (when building agda-lib dependency). Therefore I cannot even get to debugging the agda-language-server build, because haskell.nix does something else than stack. Otherwise overriding buildInputs of my derivation with the packages needed in the shell.nix would likely fix the problem.

Expected behavior

The package builds with haskell.nix. Or it fails at building the package agda-language-server and I can fix the build by overriding the derivations buildInputs - to mimick entering shell.nix in 1. before running stack build.

@zmrocze zmrocze added the bug Something isn't working label Apr 24, 2024
@zmrocze
Copy link
Author

zmrocze commented Apr 24, 2024

Found that you guys (iog i mean) have hit this problem yourself, exactly that problem:

https://github.com/IntersectMBO/plutus/blob/b97e8be50470065f37948f62dcaa7d67f71b9a39/nix/agda-project.nix#L14

Which is good because i have a fix.

But also a second time that bug is discovered.

@michaelpj
Copy link
Collaborator

The bug is arguably in agda, in that it does not build properly when using per-component builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants