-
Notifications
You must be signed in to change notification settings - Fork 238
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
Add ignorePackageYaml support to cabalProject #2094
Conversation
modules/cabal-project.nix
Outdated
ignorePackageYaml = mkOption { | ||
type = bool; | ||
default = false; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is copied from modules/stack-project.nix
. Perhaps these should be merged?
I think this only matters if the I imagine that can happen when:
Perhaps when the builder runs The builder can only do that test if knows to run |
I think so as well, but it's an invariant that's almost certainly broken by a non-empty subset of Haskell packages (at least, by Murphy's law of engineering pessimestimation) so it's best to make the new feature that breaks those packages an explicit downstream opt-in rather than impose an explicit downstream opt-out.
Personally, I think the best way to avoid this is to set up a devshell hook to run hpack when it sees the cabal file is out of date and add it to the git index to keep it from getting out of date. (Getting a list of source directories to monitor for creation/deletion and hooking to an fsnotify service would be a nice project…)
And then those modifications get checked in, and then one day somebody adds a source file or something and re-reruns hpack and the modifications are clobbered. This is probably a confusing situation for a newcomer to encounter since the trace of the modifications are hidden in the diff of a file that they entrusted a tool to modify.
Yes, that's a good idea. Does it need to go in this feature?
Settled. Should we consolidate the module option somewhere now that it's shared between Stack and Cabal projects? |
Moved The development documentation in |
Thanks! |
Now this is merged, I think we will need to bump the static |
This PR adds a command line flag to
plan-to-nix
that allows anypackage.yaml
files to be completely ignored.This implements a workaround for #1923 which is otherwise needed to support hpack
local
-style defaults. Even if the user explicitly generates the associatedfoo.cabal
files and commits them to the repo (or arranges for Nixago to do that 😏 on their behalf) the presence of thepackage.yaml
files in the source causesplan-to-nix
(regardless of the project'ssupportHpack
setting) to read thepackage.yaml
rather than the user generated.cabal
file(s) and so consequently the absence of the defaults specified in that package.yaml in the cleaned sources causesplan-to-nix
to fail.To avoid changing the behaviour of projects which already set
supportHpack
to false but inadvertently rely onplan-to-nix
loading the package.yaml files, it seemed wiser to create a new project option entirely.