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

haskell: cabal unable to find alex and happy in a shell produced with shellFor #130556

Open
d-xo opened this issue Jul 18, 2021 · 10 comments
Open

Comments

@d-xo
Copy link
Contributor

d-xo commented Jul 18, 2021

Describe the bug

I have alex and happy listed in the build-tool-depends section of my cabal file (here), but when I enter a nix shell created with haskellPackages.shellFor cabal is unable to find these dependencies and gives the following error:

Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.RemoteRepo {remoteRepoName = RepoName
"hackage.haskell.org", remoteRepoURI = http://hackage.haskell.org/,
remoteRepoSecure = Just True, remoteRepoRootKeys =
["fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0","1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42","2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3","0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d","51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921"],
remoteRepoKeyThreshold = 3, remoteRepoShouldTryHttps = True}
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: act-0.1.0.0 (user goal)
[__1] unknown package: act:happy:exe.happy (dependency of act)
[__1] fail (backjumping, conflict set: act, act:happy:exe.happy)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: act, act:happy:exe.happy

Both alex and happy are available on path in the shell:

> which alex
/nix/store/kw7250df32diiis9wx0x78irinnzibim-alex-3.2.6/bin/alex
> which happy
/nix/store/3k6bs1nz6bpkj9pfsfpmyqpfy0kjw5bd-happy-1.20.0/bin/happy

I can work around this by running cabal v2-update and then cabal will download and build alex and happy by itself, but I would prefer to avoid any impurities here and have cabal pull all it's dependencies from the nix-shell.

note that haskell.nix suffers from the same issue: input-output-hk/haskell.nix#839

cc @Ericson2314 @peti @ElvishJerricco

@matthewbauer
Copy link
Member

I think this is from switching to new-style cabal builds. A temporary workaround is to always use cabal v1- in commands.

@d-xo
Copy link
Contributor Author

d-xo commented Jul 20, 2021

Interesting! This does work ✨ 🙏 I'm curious why that would be the case though?

@matthewbauer
Copy link
Member

I think v2 is just stricter in a lot of places. Cabal wants the executable in the package database, but right now it doesn't get there.

@d-xo
Copy link
Contributor Author

d-xo commented Jul 21, 2021

I see, do you know what would be required to get the executables into the package database in the nix shell? I would be interested to maybe try and make a PR here, but I'm very unfamiliar with the nix haskell infra and how cabal works in general...

@Ericson2314
Copy link
Member

Yeah there some some issue about this before. There isn't a good way to get it in the package database. And for thing like is just an exe it doesn't make much since. It would be nicer if there was some other way to tell cabal "trust me, I'm the right version".

@d-xo
Copy link
Contributor Author

d-xo commented Jul 22, 2021

Why shouldn't an executable go into the package db? It seems as though the v2 cabal workflows expect them to be there?

@stale
Copy link

stale bot commented May 1, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label May 1, 2022
@sternenseemann sternenseemann removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label May 1, 2022
@sternenseemann
Copy link
Member

Using v1-* commands is still the only workaround known to me.

@ParetoOptimalDev
Copy link

Why shouldn't an executable go into the package db? It seems as though the v2 cabal workflows expect them to be there?

See this related issue: haskell/cabal#8434

@ScottFreeCode
Copy link

ScottFreeCode commented Jul 26, 2023

A more complete but still minimal reproduction is here: https://gist.github.com/ScottFreeCode/c1adb5681c5b61c61373615f63a4a7d2

I've collected GitHub issues relating to this problem here: https://gist.github.com/ScottFreeCode/ef9f254e2dd91544bba4a068852fc81f

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

No branches or pull requests

7 participants