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

Cannot get cabal-fmt to build with hackage-tool #1008

Closed
ocharles opened this issue Jan 19, 2021 · 10 comments
Closed

Cannot get cabal-fmt to build with hackage-tool #1008

ocharles opened this issue Jan 19, 2021 · 10 comments

Comments

@ocharles
Copy link
Contributor

If I do:

    self.haskell-nix.hackage-tool {
      compiler-nix-name = "ghc8101";
      name = "cabal-fmt";
      version = "0.1.4";
    }

I get:

❯ nix-build -E '(import ./nix/pkgs {}).cabal-fmt'
warning: unknown setting 'experimental-features'
trace: No index state specified for cabal-fmt, using the latest index state that we know about (2021-01-19T00:00:00Z)!
warning: unknown setting 'experimental-features'
building '/nix/store/4v7mg6xvvncw8lpw3rmg8jr2jrhfkha6-cabal-fmt-plan-to-nix-pkgs.drv'...
Using index-state 2021-01-19T00:00:00Z
Warning: The package list for 'hackage.haskell.org-at-2021-01-19T000000Z' is
18646 days old.
Run 'cabal update' to get the latest list of available packages.
Warning: Requested index-state2021-01-19T00:00:00Z is newer than
'hackage.haskell.org-at-2021-01-19T000000Z'! Falling back to older state
(2021-01-18T22:55:30Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: Cabal (user goal)
[__0] rejecting: Cabal-3.2.1.0, Cabal-3.2.0.0/installed-3.2.0.0,
Cabal-3.2.0.0, Cabal-3.0.2.0, Cabal-3.0.1.0, Cabal-3.0.0.0 (constraint from
user target requires ==2.5.0.0)
[__0] trying: Cabal-2.5.0.0
[__1] rejecting: Cabal:!test (constraint from config file, command line flag,
or user target requires opposite flag selection)
[__1] trying: Cabal:*test
[__2] next goal: optparse-applicative (dependency of Cabal *test)
[__2] rejecting: optparse-applicative-0.16.1.0, optparse-applicative-0.16.0.0,
optparse-applicative-0.15.1.0, optparse-applicative-0.15.0.0 (conflict: Cabal
*test => optparse-applicative>=0.13.2.0 && <0.15)
[__2] trying: optparse-applicative-0.14.3.0
[__3] next goal: base (dependency of Cabal)
[__3] rejecting: base-4.14.0.0/installed-4.14.0.0 (conflict:
optparse-applicative => base>=4 && <4.13)
[__3] skipping: base-4.14.1.0, base-4.14.0.0, base-4.13.0.0 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=4 && <4.13' from 'optparse-applicative')
[__3] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__3] fail (backjumping, conflict set: Cabal, base, optparse-applicative)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: Cabal, optparse-applicative,
Cabal:test, base
Try running with --minimize-conflict-set to improve the error message.

I'm not really sure what's going on. I tried adding

      modules = [ { reinstallableLibGhc = true; } ];

But I get the same.

@ocharles
Copy link
Contributor Author

With

      configureArgs = "--disable-tests";
❯ nix-build -E '(import ./nix/pkgs {}).cabal-fmt'
warning: unknown setting 'experimental-features'
trace: No index state specified for cabal-fmt, using the latest index state that we know about (2021-01-19T00:00:00Z)!
warning: unknown setting 'experimental-features'
building '/nix/store/8vr7aj6s3gj85klr3ci194m0rszb71pr-cabal-fmt-plan-to-nix-pkgs.drv'...
Using index-state 2021-01-19T00:00:00Z
Warning: The package list for 'hackage.haskell.org-at-2021-01-19T000000Z' is
18646 days old.
Run 'cabal update' to get the latest list of available packages.
Warning: Requested index-state2021-01-19T00:00:00Z is newer than
'hackage.haskell.org-at-2021-01-19T000000Z'! Falling back to older state
(2021-01-18T22:55:30Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: cabal-fmt (user goal)
[__0] rejecting: cabal-fmt-0.1.5.1, cabal-fmt-0.1.5, cabal-fmt-0.1.4,
cabal-fmt-0.1.3, cabal-fmt-0.1.2, cabal-fmt-0.1.1, cabal-fmt-0.1 (constraint
from user target requires ==0)
[__0] rejecting: cabal-fmt-0 (constraint from user target requires ==0.1.4)
[__0] fail (backjumping, conflict set: cabal-fmt)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cabal-fmt

@michaelpj
Copy link
Collaborator

That's very weird. The log output makes no sense to me: the first thing we see is it trying to solve for Cabal and saying it has a user goal of Cabal==2.5.0.0, whereas cabal-fmt says Cabal >=3.2.0.0. I have no idea what's going on there.

@michaelpj
Copy link
Collaborator

[__0] rejecting: cabal-fmt-0.1.5.1, cabal-fmt-0.1.5, cabal-fmt-0.1.4,
cabal-fmt-0.1.3, cabal-fmt-0.1.2, cabal-fmt-0.1.1, cabal-fmt-0.1 (constraint
from user target requires ==0)

what on earth???

@ocharles
Copy link
Contributor Author

Yea, very puzzling! I'm going to try adding a cabal.project...

@ocharles
Copy link
Contributor Author

Bingo! It's the lack of a cabal.project that blows this all up. The following works:

    self.haskell-nix.hackage-tool {
      compiler-nix-name = "ghc8101";
      name = "cabal-fmt";
      version = "0.1.4";
      cabalProject = ''
        packages: .
      '';
    };

@brendanhay
Copy link

I'm glad I came across this by chance - I've had this issue with cabal-fmt for over a year, thanks @ocharles!

@michaelpj
Copy link
Collaborator

Hm, I think this should still be open: you shouldn't need the cabal.project, something is rather odd.

@michaelpj michaelpj reopened this Feb 17, 2021
@TerrorJack
Copy link
Contributor

Seems that the cabalProject hack can be removed given the latest haskell.nix revision, just fyi.

@ocharles
Copy link
Contributor Author

I wonder what fixed it!

@hamishmack
Copy link
Collaborator

Checked this and it seems ok now:

nix-build -E '((import ./. {}).pkgs-unstable.haskell-nix.tool "ghc8107" "cabal-fmt" {})'

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

5 participants