Closed mrcjkb closed 1 year ago
Marking this as a draft. It might be better to use the locally checked out repositories as inputs, instead of the dependencies on hackage.
Thank you for your contribution. I'm going to check building with your cabal file locally.
@phoityne I have added the nix infrastructure to https://github.com/phoityne/haskell-dap/pull/14 and https://github.com/phoityne/ghci-dap/pull/11.
They are used as inputs for this flake, allowing for hermetic builds during development.
If either of the dependencies is changed, the changes can be applied to this project with nix flake update
.
Note: IMO, these projects would be easier to maintain if they were merged into a monorepo. Is there a reason you have chosen to put them in separate repositories?
Hi. I'm not a NixOS user. Is this PR what haskell-tools.nvim needs ? PR to build haskell-tools.nvim on haskell-tools.nvim repository ?
Or an improvement suggestion for this project ? (such as auto lint, build, test,, by github actions.)
It's not needed for haskell-tools.nvim.
(nix can be used on any Linux distro and on MacOS).
The GitHub actions workflow is an improvement suggestion.
Thank you for the suggestion. Is this still draft state ? Because no side effect to users, released packages, haskell-tools.nvim, I think it's ok to be merged.
Thank you for the suggestion. Is this still draft state ? Because no side effect to users, released packages, haskell-tools.nvim, I think it's ok to be merged.
I just have to update the flake inputs for ghci-dap and haskell-dap to point to your repos (they currently point to my forks) and update the lock file. Then this should be ready.
I'll do that later today.
Done. This is ready to be merged :)
Thanks for your contribution. merged.
In the future, I hope to be able to use the same mechanism to check builds and create binaries.
Especially ghci-dap, I think you can install it with ghcup if we prepare binaries for each distro and ghc version.
Sounds reasonable.
If ghci-dap is a requirement for haskell-debug-adapter, it might make sense to package them together.
The nice thing about using nix for tests/checks is that they can be reproduced locally by anyone who has nix installed. That can often be difficult with GitHub actions. But for this project, it definitely makes sense to test with different ghc versions, too.
Hi.
I am looking into adding support for haskell-debug-adapter to my haskell-tools.nvim neovim plugin. This means I may become interested in contributing to this project in the future. :smile:
As I use NixOS for development, I have added some infrastructure for using nix to build this project and run tests - which I am requesting to merge with this PR.
I have also added a GitHub action that runs the test suite on PR and push to
master
.The nix flake uses pre-commit-hooks.nix to
hpack
to generate a cabal file from thepackage.yaml
.cabal2nix
to generate adefault.nix
from the previously generated cabal file - which is then used innix/overlay.nix
to build the package.alejandra
for nix formatting.This could potentially be extended to also run
hlint
and a Haskell formatter. I have omitted these, as they would result in modifications to the Haskell source files. A potential downside to adding linters and formatters is that the CI could fail if someone uses a different version ofhlint
or the formatter than the version used in the nix build. For anyone who has nix installed, this is not a problem, as long as they usenix develop
to enter a nix shell with the correct versions of the packages installed.The same applies to the
haskell-debug-adapter.cabal
, which is generated byhpack
. The file has been changed in this PR, because the nix infrastructure uses a newer version ofhpack
.hpack
has lowered the lower bounds of the dependencies inhaskell-debug-adapter.cabal
. This indicates that thepackage.yaml
and stack resolver is not the source of truth for this build (?). If need be, I can revert that change and remove thehpack
pre-commit-hook. Although this discrepancy looks to me like it could lead to inconsistent results between stack and cabal builds.