Skip to content

[RFC] Cabal plugin infrastructure #7825

Open
@Kleidukos

Description

@Kleidukos

This is a WIP. Fendor & I will edit this description to refine the features & requirements.

Inspirations

  • git
  • cargo

Reasoning

To avoid bloat in cabal-install CLI and offer a more ergonomic way to use plugins, we must offer first-class support for cabal CLI plugins.

More importantly, it allows us to provide features in "beta" or "experimental" status to our users before integrating them into the CLI codebase when they are more mature.
This is a low-tech solution but tech is not the only aspect being considered here.

What we need

  • Plugin infrastructure for cabal CLI

    • cabal instal --plugin
      • It is installed in ~/.cabal/bin XOR ~/.cabal/plugins/bin
      • When people type cabal foo, if foo is not a valid subcommand, we lookup cabal-foo in the bin directory.
    • Provide a cabal-metadata package as companion tooling for plugin authors
      • Provide structure representation of the plan.json & build-info.json
    • Handle incompatibilities between Cabal versions. Need more thought.
      • JSON incompatibilities
      • Binary incompatibilities
  • Cabal version compatibility

    • One plugin version per project?
    • One plugin version per installed ghc.
      • Call ghcup directly to install cabal plugins. Symlink logic is reused, the same as HLS
  • Cabal command-line arguments passing

    • This amounts to calling another binary with the parameters passed. Do we want to setup some stuff on the cabal-install side (like environment variables) before calling the binary (cabal-foo in ~/.cabal/bin)?

cc @fendor

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: RFCRequests for Comment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions