-
Notifications
You must be signed in to change notification settings - Fork 24
WIP: Better packages
detection
#93
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
Conversation
@@ -0,0 +1,46 @@ | |||
# Like pkgs.haskell.lib.haskellPathsInDir' but with a few differences | |||
# - Allows top-level .cabal files | |||
# - Recurses into subdirectories |
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.
Recursing into arbitrary subdirectories hurts performance. This will be exacerbated by projects that rely on lazy fetching of git submodules.
make haskellPathsInDir perfect
Not sure if perfect exists. I'd prefer a cabal.project or stack.yaml parser.
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.
Recursing into arbitrary subdirectories hurts performance.
Doesn't nix copy the source tree to the store anyway? I ran this on a large internal mono repo with 31 packages using package.yaml which all lie as far as 5 sub-directories deep, and didn't notice a perceptible difference (to be fair, this was on my M1 Max). But yes performance degradation is a valid concern. I'll benchmark it properly before we stamp this PR for approval.
This will be exacerbated by projects that rely on lazy fetching of git submodules.
Lazy fetching of git submodules?
I'd prefer a cabal.project or stack.yaml parser.
I don't know about stack (why would someone use stack if there is Nix?) - but cabal.project
parsing is indeed better (ie. #76); here's our cabal.project
packages:
lib/*/*.cabal
app/*/*/*.cabal
app/*/*/*/*.cabal
test/*.cabal
(cabal.project
doesn't support hpack, so we would also have to look for package.yaml
)
I suppose we can just write a Haskell executable (put it in pkgs.haskellPackages.<whatever>
) and then use that to get a JSON back. This Haskell executable can also expose the hpack YAML data as JSON to Nix. In a way, it would be like cabal2nix. Maybe I should just go this route instead of this PR ...
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.
Haskell executable
Like https://github.com/NorfairKing/cabal2json#readme
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 Haskell executable can even do the traversal and return packages information.
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.
Lazy fetching of git submodules?
Sorry, I should have explained myself. I'm considering unimplemented lazy-trees features.
why would someone use stack if there is Nix?
The stack repl
multi-module hack is rather useful. You can load a repl where all local packages are quick-reloadable.
There's also horizon-haskell, which is like Nixpkgs Haskell, but more stackage based.
I suppose we can just write a Haskell executable (put it in
pkgs.haskellPackages.<whatever>
) and then use that to get a JSON back.
It would be really nice to avoid IFD for this purpose. Ideally, the set of flake attribute names can be determined without doing any IFD. This keeps evaluation quick, especially on monorepos, and especially when you don't always need a haskell package in an evaluation.
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.
Closing in favour of #110 |
Make
packages
option traverse sub-dirs recursively as well as recognizepackage.yaml
cabal.project