Skip to content

Stackage import does not work correctly for LTS-15.x #481

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

Closed
serras opened this issue Mar 10, 2020 · 18 comments
Closed

Stackage import does not work correctly for LTS-15.x #481

serras opened this issue Mar 10, 2020 · 18 comments
Labels
bug Something isn't working wontfix

Comments

@serras
Copy link
Contributor

serras commented Mar 10, 2020

The automatically-generated .nix files for Stackage LTS until 14.x contain the bundled packages, like stm, both in the compiler section and as a regular package. Alas, from 15.x, the packages in the compiler section are not found as regular packages. That means that if you depend on one of those packages (we do in particular depend on stm) the build fails.

I am happy to provide a PR on this with some guidance :)

@codygman
Copy link

codygman commented Mar 16, 2020

I'm also affected by this bug and created a reproduction that only requires cloning a repo running a script.

@dhess
Copy link
Contributor

dhess commented Mar 22, 2020

Ahh, does this explain why I'm getting errors like error: The Haskell package set does not contain the package: text (build dependency). when trying to build against LTS-15?

@serras
Copy link
Contributor Author

serras commented Mar 22, 2020 via email

@zimbatm
Copy link

zimbatm commented Mar 22, 2020

From a quick glance it seems like ghc-boot-packages should use the packages from the compiler section. But it's hard to tell, this project is really complicated.

@serras
Copy link
Contributor Author

serras commented Mar 22, 2020

@codygman I've opened a PR against nix-tools input-output-hk/nix-tools#83 Unfornately, I cannot check that it works on my current machine, could you try using your repo and check whether it actually solves the problem?

@angerman
Copy link
Collaborator

@serras that looks conceptually correct.

@angerman
Copy link
Collaborator

But it's hard to tell, this project is really complicated.

It tries to be very simple at the core, but there are so many edge cases.

The high level overview is this: we either have a stack project, or a cabal project. Both lead to a solution of packages to be used. For stack this is the curated package set. For cabal, this is what ever cabal configure computes and provides through the plan.json file.
The recent switch in stackage's format (introduces for LTS-15+), did drop the compiler packages from the plan.

To have nix understand this world, we'll translate all of hackage to nix (hackage.nix), stackage (stackage.nix), and cabal plans. All via nix-tools from some non-nix description to a nix-description. nix-toolss only purpose is to translate into something nix can understand.

Finally haskell.nix will then tie it all together in the nix world. (potentially calling out to nix-tools and IFDing expressions that can not be reasonably pre-computed. For example computing, and translating plan.json with cabal and nix-tools).

One general goal is to abstract cabal and stack away, such that the inputs to haskell.nix are of the same shape. It shouldn't make a difference if the curated package set was pre-computed (stack), or computed on demand (cabal). haskell.nix should only have to know about package sets.

@TravisWhitaker
Copy link
Contributor

@angerman Now that input-output-hk/nix-tools#83 is merged, what needs to be done to fix this up in haskell.nix? I too am stuck on errors of the form error: The Haskell package set does not contain the package: text (build dependency)..

@TravisWhitaker
Copy link
Contributor

@serras @codygman As a workaround, you can use LTS-15 if you add this set to your package set's modules list:

{ nonReinstallablePkgs =                                                                                                                                                                      [64/94]
                [ "rts"
                  "ghc-heap"
                  "ghc-prim"
                  "integer-gmp"
                  "integer-simple"
                  "base"
                  "deepseq"
                  "array"
                  "ghc-boot-th"
                  "pretty"
                  "template-haskell"
                  "ghcjs-prim"
                  "ghcjs-th"
                  "ghc-boot"
                  "ghc"
                  "Cabal"
                  "Win32"
                  "array"
                  "binary"
                  "bytestring"
                  "containers"
                  "directory"
                  "filepath"
                  "ghc-boot"
                  "ghc-compact"
                  "ghc-prim"
                  "ghci"
                  "haskeline"
                  "hpc"
                  "mtl"
                  "parsec"
                  "process"
                  "text"
                  "time"
                  "transformers"
                  "unix"
                  "xhtml"
                  "stm"
                  "terminfo"
                ];
            }

This works by forcing all GHC boot packages to be copied from the global package database, as described in #524

@angerman
Copy link
Collaborator

@angerman Now that input-output-hk/nix-tools#83 is merged, what needs to be done to fix this up in haskell.nix? I too am stuck on errors of the form error: The Haskell package set does not contain the package: text (build dependency)..

Which LTS/nightly snapshot?

@TravisWhitaker
Copy link
Contributor

@angerman Sorry, I was really asking what else was needed to get builds working with LTS-15.x.

@angerman
Copy link
Collaborator

@TravisWhitaker ahh I see the LTS's didn't update as expected in stackage.nix :-/ Guess I'll have to hand intervene again.

@TravisWhitaker
Copy link
Contributor

@angerman I think the LTS files in stackage.nix are correct, but builds with LTS-15 are failing for the reason identified in #524. Run something like nix build '(with import <nixpkgs> (import ./.); haskell-nix.snapshots."lts-15.5").lens.components.library' --show-trace on HEAD of haskell.nix master and you should see something like:

$ nix build '(with import <nixpkgs> (import ./.); haskell-nix.snapshots."lts-15.5").lens.components.library' --show-trace
error: while evaluating the attribute 'SETUP_HS' of the derivation 'lens-4.18.1-lib-lens' at /nix/extras/sources/haskell.nix/builder/comp-builder.nix:153:3:
while evaluating the attribute 'buildPhase' of the derivation 'lens-4.18.1-setup' at /nix/extras/sources/haskell.nix/builder/setup-builder.nix:38:7:
while evaluating anonymous function at /nix/extras/sources/haskell.nix/builder/setup-builder.nix:14:32, called from /nix/extras/sources/haskell.nix/builder/setup-builder.nix:14:23:
while evaluating the attribute 'identifier.name' at undefined position:
while evaluating anonymous function at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:336:9:
while evaluating the option `packages.Cabal.package.identifier.name':
The option `packages.Cabal.package.identifier.name' is used but not defined.

@angerman
Copy link
Collaborator

@TravisWhitaker I believe the issues is that since input-output-hk/nix-tools#83, the LTS-15 expressions in stackage.nix haven't been regenerated.

@TravisWhitaker
Copy link
Contributor

@angerman the expressions generated for nightlies after input-output-hk/nix-tools#83 don't work either, also because of #524:

$ git rev-parse HEAD
8040c12c54bfecc9931456b8c8502965d7af3b9b
$ nix build '(with import <nixpkgs> (import ./.); haskell-nix.snapshots."nightly-2020-03-26").lens.components.library' --show-trace
error: while evaluating the attribute 'snapshots.nightly-2020-03-26' at undefined position:
while evaluating 'mkSnapshot' at /nix/extras/sources/haskell.nix/snapshots.nix:14:22, called from undefined position:
while evaluating the attribute 'config.hsPkgs' at undefined position:
while evaluating anonymous function at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:336:9:
while evaluating the option `hsPkgs':
while evaluating the attribute 'isDefined' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:348:28, called from /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:415:25, called from /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:234:44:
while evaluating the attribute 'packages' at undefined position:
while evaluating anonymous function at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:336:9:
while evaluating the option `packages':
while evaluating the attribute 'isDefined' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:348:28, called from /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:415:25, called from /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/extras/sources/anduril-nixpkgs/lib/modules.nix:234:44:
while evaluating 'filterAttrs' at /nix/extras/sources/anduril-nixpkgs/lib/attrsets.nix:124:23, called from /nix/extras/sources/haskell.nix/modules/plan.nix:270:8:
while evaluating anonymous function at /nix/extras/sources/anduril-nixpkgs/lib/attrsets.nix:125:29, called from /nix/extras/sources/anduril-nixpkgs/lib/attrsets.nix:125:18:
while evaluating anonymous function at /nix/extras/sources/haskell.nix/modules/plan.nix:270:28, called from /nix/extras/sources/anduril-nixpkgs/lib/attrsets.nix:125:62:
while evaluating the attribute 'revision' at /nix/store/xkpbganns8bm284c14h1sisqh25c58k5-stackage-snapshot-source/nightly-2020-03-26.nix:1742:7:
attribute '3.0.1.0' missing, at /nix/store/xkpbganns8bm284c14h1sisqh25c58k5-stackage-snapshot-source/nightly-2020-03-26.nix:1742:28

@domenkozar
Copy link
Contributor

I have an idea how to override Cabal in stackage, will play around tomorrow.

@domenkozar
Copy link
Contributor

Here's a patch that was made for stack2nix: nh2/stack2nix@c009e33#diff-5cecbf2a44d1043802f1c0377b4f1a7cR210

@yvan-sraka yvan-sraka added the bug Something isn't working label Sep 20, 2022
@stale
Copy link

stale bot commented Jan 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 18, 2023
@stale stale bot closed this as completed Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix
Projects
None yet
Development

No branches or pull requests

8 participants