-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Support cabal.project files #286
Comments
Please ignore the fact that my example is flawed since |
This would be incredibly helpful. At the moment what I'm doing for a web project is using 3 separate cabal packages: To work on the If |
For what it's worth, I started working on a patch along these lines here. Unfortunately time has been lacking to carry it on. Essentially, it rips the install plan out of |
Until this ticket gets an implementation the solution is to use |
Pretty sure this can be closed because of the existence of |
I think documenting |
I don't think there's a good solution to automating this. Making a shell.nix manually isn't hard and you rarely need to update the file.
|
Generating a shellFor expression seems trivial and better than nothing. Why not exactly? |
@Elvecent Do you mean cabal2nix should offer generating a shellFor expression from the cabal.project file? |
Yes, exactly.
I don't understand which place do you have in mind for keeping these examples and docs. Do you mean cabal2nix should print related instructions as opposed to readily usable Nix expression, or do you mean it's simply out of scope for cabal2nix? |
It was my impression that cabal2nix has a long history of feature creep. So my intuition is, that a lot of things are out of scope for cabal2nix, yes. But I would probably need a discussion with the other maintainers to make up my mind as to what exactly should be included and what not. I think docs and examples for how to setup a dev environment, including for how setup a dev environment for multiple packages at the same time, belong in the nixpkgs manual. |
I think support for cabal.project files can probably be implemented as a feature for shellFor in nixpkgs given someone looks into implementing the required globbing (which can probably be adapted from gitignore code that‘s already in nixpkgs). |
I think support for cabal.project files can probably be implemented as a feature for shellFor given someone looks into implementing the required globbing (which can probably be adapted from gitignore code that‘s already in nixpkgs).
… On 21. May 2022, at 21:32, maralorn ***@***.***> wrote:
It was my impression that cabal2nix has a long history of feature creep. So my intuition is, that a lot of things are out of scope for cabal2nix, yes. But I would probably need a discussion with the other maintainers to make up my mind as to what exactly should be included and what not.
I think docs and examples for how to setup a dev environment, including for how setup a dev environment for multiple packages at the same time, belong in the nixpkgs manual.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
cabal2nix
should support something similar tohaskell.lib.buildStackProject
for projects with acabal.project
file. I suspect this will essentially amount to a derivation with{ configurePhase = "cabal new-configure"; buildPhase = "cabal new-build"; }
. The work thatcabal2nix
needs to do is find all the cabal files in the project and put together the list of dependencies that need to be present in the build.My main motivation for this is the "common package" problem often encountered in web development. You have a
backend
package and afrontend
, and you also have acommon
package for code shared between them. The most common workflow that I've seen is to have an extension ofhaskellPackages
like this:Each of the three source directories then has a
shell.nix
file that just doeshaskellPackages.<package>.env
. Finally, you can usenix-shell --run "cabal configure"
so that you can do incremental compilation with justcabal build
. The problem with this approach is that any change tocommon
will necessitate:common
Nix derivationbackend
andfrontend
must both redo theircabal configure
command, sincecommon
is now changed.backend
andfrontend
to be rebuilt from scratch.You want incremental development so that a change to
common
merely requires incremental recompilation. This is something thecabal.project
layout does spectacularly well. So it'd be nice to have a Nix expression that lets us usecabal new-build
for local incremental development with thecabal.project
file, andnix-build
for a deterministic Nix build. I suppose thenix-build
, likebuildStackProject
, would merely output executables, and would not be suited to building a lib for other Haskell derivations to depend on.The text was updated successfully, but these errors were encountered: