Skip to content

Support store-dir and package-env in cabal.project #10184

Open

Description

@hasufell

Describe the feature request

It seems like an oversight that these aren't supported. I would have expected that cabal.project is kind of a superset of cabal.config.

I don't really see any problems allowing them to be set at the project level. It actually seems kind of intuitive to do so.

Additional context

This is needed to implement a prototype for cabal sandboxes, see: #10098

Activity

  1. andreabedini commented on Jul 10, 2024

    @andreabedini
    Collaborator

    The tl;dr is that, as it stands now, they are not part of the project configuration (which is ProjectConfig).

    With respect to store-dir; I had left some comments in the code.

    -- *Important:* You can notice how some project config options are needed to read the
    -- project config! This is evident by the fact that "rebuildProjectConfig"
    -- takes "HttpTransport" and "DistDirLayout" as parameters. Two arguments are
    -- infact determined from the CLI alone (in "establishProjectBaseContext").
    -- Consequently, project files (including global configuration) cannot
    -- affect those parameters!
    . One could say it's part of the environment where the project lives more than the project configuration itself. E.g. same ProjectConfig with two different StoreLayouts would build "exacty" the same (take this with a grain of salt).

    With respect to package-env; this is a flag (cinstEnvironmentPath) specific to v2-install. I am not sure what meaning it would have inside ProjectConfig.

    AFAIU ProjectConfig is based on the content of the global configuration (which is indeed parsed into a ProjectConfig as well). Perhaps there is a distinction between "project configuration" and "local configuration of the build tool" that hasn't been explored.

  2. hasufell commented on Jul 28, 2024

    @hasufell
    MemberAuthor

    Can we get a conceptual decision on this, so someone can go ahead and provide a PR?

  3. ulysses4ever commented on Jul 28, 2024

    @ulysses4ever
    Collaborator

    Will it suffer the same issue that stopped --builddir from inclusion into project files?

  4. hasufell commented on Jul 28, 2024

    @hasufell
    MemberAuthor

    Will it suffer the same issue that stopped --builddir from inclusion into project files?

    Could you expand why?

  5. ulysses4ever commented on Jul 29, 2024

    @ulysses4ever
    Collaborator

    Why what? I didn't make any statement, I only asked a question.

  6. gbaz commented on Jul 29, 2024

    @gbaz
    Collaborator

    i think we should in spirit agree to adding the fields. that said, i think in the resultant sandbox-like workflow they should be added to cabal.project.local since they don’t make sense to check in to source.

    also, in my cursory read of the linked ticket, i don't think the same caching considerations should apply here.

  7. geekosaur commented on Aug 1, 2024

    @geekosaur
    Collaborator

    Right, I don't see either one affecting caching, so this should be okay modulo their not being part of the things we currently initialize from cabal.project(.local).

  8. ivanperez-keera commented on Sep 12, 2024

    @ivanperez-keera
    Contributor

    Gentle bump

  9. geekosaur commented on Sep 12, 2024

    @geekosaur
    Collaborator

    I think this is not happening soon because

    1. we're currently making a lightning release for the GHC devs
    2. it will require a fair amount of work, because cabal's architecture isn't up to this rearrangement currently (in particular, I think at present store-dir needs to be fixed before the project file is read, and as such may be used during parsing of package stanzas).

    There are a couple of other open requests that will require rethinking how and where project files fit into cabal's architecture (e.g. #9230 / #10016 / #10253, which would require some way to put information that currently is associated with *.cabal files in project files).

  10. hasufell commented on Sep 12, 2024

    @hasufell
    MemberAuthor

    I think this is not happening soon because

    The main idea of this ticket wasn't to ask cabal devs to do it. But to ask for consensus before a volunteer might work on it, so that no one wastes their time.

    Can I assume that there is basic consensus? Ofc an implementation may open further doubts/questions.

    There are a couple of other open requests that will require rethinking how and where project files fit into cabal's architecture

    This ticket is definitely not about refactoring the current architecture. I want to avoid scope creep.

    I think at present store-dir needs to be fixed before the project file is read

    @andreabedini do you have further insights into this?

  11. geekosaur commented on Sep 12, 2024

    @geekosaur
    Collaborator

    I think @gbaz does. And as @gbaz said, we have agreement in spirit. My worry is that it might be a nightmare to implement in cabal as it currently exists. We keep running into unexpected nasty interactions with things that "ought to be" easy (I think @philderbeast can attest to a few of these?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions