Skip to content

Autodetect "packages" based on cabal.project (and package.yaml) #110

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

Merged
merged 28 commits into from
Mar 10, 2023
Merged

Conversation

srid
Copy link
Owner

@srid srid commented Mar 9, 2023

Resolves #76 & adds a projectRoot option.

This PR doesn't implement support for globs; users are expected to write down each package by hand in cabal.project. Latter we can improve this.

  • Working Prototype
  • Edge cases
    • Sometimes the cabal.project can live in a sub directory (eg: ./Backend). Do we support this case, and if so how? (EDIT: Can just add projectRoot option)
  • Add tests for the parser; cf. https://www.tweag.io/blog/2022-09-01-unit-test-your-nix-code/
  • Refactor, and maybe consider putting this code in external flake?
  • Friendly error messages
    • On parse failure in particular instruct the user what to do rather than just throwing parse errors
    • If the package path has globs (*), print the limitation asking the user to set "packages" manually.
  • Documentation

With this PR, haskell-flake gets its first flake dependency https://github.com/kanwren/nix-parsec which is slightly concerning, because the goal is to keep haskell-flake a thin abstraction on top of nixpkgs without growing to be a behemoth (eg: haskell.nix). (EDIT: Decided to just use fetchGit for this dependency, which is only evaluated if the user evaluates the default)

@srid srid requested a review from roberth March 9, 2023 20:14
@srid srid mentioned this pull request Mar 9, 2023
4 tasks
@srid
Copy link
Owner Author

srid commented Mar 9, 2023

Implementation works (no globs supported); what's left - refactoring, better error messages, and documentation update.

@srid srid changed the title WIP: Autodetect "packages" based on cabal.project (and package.yaml) Autodetect "packages" based on cabal.project (and package.yaml) Mar 10, 2023
@srid srid marked this pull request as ready for review March 10, 2023 14:18
@srid srid merged commit 56d8d97 into master Mar 10, 2023
@srid srid deleted the parser branch March 10, 2023 14:41
@peterbecich
Copy link

This is great, makes it easier to use haskell-flake, thanks!

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

Successfully merging this pull request may close these issues.

Default for packages option should use cabal.project if it exists
2 participants