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 build broken on x86_64-linux #244

Open
solomon-b opened this issue Sep 19, 2023 · 3 comments
Open

Nix build broken on x86_64-linux #244

solomon-b opened this issue Sep 19, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@solomon-b
Copy link

I'm trying to build from the master branch:

➜ nix build
error: flake 'git+file:///home/solomon/Development/Haskell/ghc-specter' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'
@wavewave
Copy link
Collaborator

The recommended use is nix develop .# if you want to build ghc-specter inside the shell or nix develop .#env if you want to have a shell with ghc-specter-daemon executable. In any case, you need to use ghc-specter-plugin as a plugin library (with ghc options: -fplugin Plugin.GHCSpecter -plugin-package ghc-specter-plugin for your target project)

Just to check the nix build usingnix build, please use nix build .#ghc962.ghc-specter-daemon and nix build .#ghc962.ghc-specter-plugin

@solomon-b
Copy link
Author

solomon-b commented Sep 20, 2023

The recommended use is nix develop .# if you want to build ghc-specter inside the shell or nix develop .#env if you want to have a shell with ghc-specter-daemon executable. In any case, you need to use ghc-specter-plugin as a plugin library (with ghc options: -fplugin Plugin.GHCSpecter -plugin-package ghc-specter-plugin for your target project)

Just to check the nix build usingnix build, please use nix build .#ghc962.ghc-specter-daemon and nix build .#ghc962.ghc-specter-plugin

Thanks, I was just trying out the nix build. The README doesn't say this, but I believe I need to add the plugin as a dependency of my project?

Simply calling cabal build --ghc-options "-fplugin Plugin.GHCSpecter -plugin-package ghc-specter-plugin" with the daemon running results in:

<command line>: cannot satisfy -plugin-package ghc-specter-plugin

@wavewave
Copy link
Collaborator

Yeah, it's a little tricky to explain it to cover all the cases (in combination of wrapped GHC/ghc-pkg, cabal and nix). Inside the nix shell provided by nix develop .#env, ghc-specter-plugin is already visible by default (as you can check ghc-pkg list), so cabal would know how to satisfy -plugin-package ghc-specter-plugin. But if it's somehow not visible, specifying ghc-specter-plugin as a dependency of a project is a workaround.

In principle, the GHC's plugin system is designed to be outside the dependency list of a project. It's "GHC's dependency", not target project's dependency. So if ghc-specter-plugin is installed somewhere and you know where its package db file is, then you can in fact specify the plugin package explicitly by giving the ghc options -package-db.
I will add the documentation on those configuration troubleshooting. Thanks!

@wavewave wavewave added documentation Improvements or additions to documentation question Further information is requested labels Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants