Skip to content

About

A mise backend plugin that installs Hackage tools through Cabal.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

mise-cabal

A mise backend plugin that installs Haskell command-line tools from Hackage using cabal-install, the same way the built-in npm:, gem:, and cargo: backends install tools from their ecosystems.

mise use mise-cabal:pandoc-cli@latest
mise use mise-cabal:hlint@3.8
mise x mise-cabal:shellcheck -- --version

Each tool is referenced as mise-cabal:<hackage-package>@<version>.

Note: mise-cabal: here is the backend prefix provided by this plugin. It is not the same as the cabal binary tool (which you install separately, see below).

Requirements

  • mise 2026.10.17 or newer

We compile tools from source, so a working Haskell toolchain is needed:

  • Cabal
  • GHC

The easiest way is to let mise manage everything, in conjunction with the mise-ghcup plugin. Add to your mise.toml:

min_version = "2026.10.17"

[tools]
"cabal" = "latest"
"ghcup" = "latest"
"mise-ghcup:ghc" = "latest"

[plugins]
"vfox-backend:mise-ghcup" = "packslip:wasp-lang/mise-ghcup#3.0.0"

[settings]
experimental = true # Needed for using backend plugins like mise-ghcup and mise-cabal

Usage

Add the plugin to your mise.toml, pinned to a release. Releases are signed packslip archives, so mise verifies the plugin before installing it:

[plugins]
"vfox-backend:mise-cabal" = "packslip:wasp-lang/mise-cabal#2.0.0"

[settings]
experimental = true # Needed for using backend plugins like mise-cabal

Or install it from the command line:

mise plugins install vfox-backend:mise-cabal 'packslip:wasp-lang/mise-cabal#2.0.0'

Then you can use it freely:

# Search Hackage for a package
mise search mise-cabal:lint

# List the versions available on Hackage
mise ls-remote mise-cabal:hlint

# Install a specific version
mise install mise-cabal:hlint@3.8

# Use it (in the current dir, or globally with -g)
mise use mise-cabal:hlint@latest

# Run it
mise x mise-cabal:hlint@latest -- --version

You can also add tools directly to a mise.toml:

[tools]
"mise-cabal:pandoc-cli" = "latest"
"mise-cabal:hlint" = "3.8"

How it works

  • Searching (mise search, shell completion) runs cabal list against a Hackage package index shared by all tools, kept in mise's cache directory and refreshed with cabal update. It matches package names and shows each package's synopsis.
  • Listing (ls-remote) reads the published versions from the same index, along with each version's upload date, so minimum_release_age and --before can filter them.
  • If the shared index is unavailable (for example, cabal is not installed yet), searching and listing fall back to the Hackage API, whose versions are undated.
  • Installing sets CABAL_DIR to the tool version's own mise install directory and runs cabal install <package>-<version>. Because CABAL_DIR relocates cabal's whole home, the build store and binaries live inside that directory. The package index and source tarballs come from the shared cache (--remote-repo-cache), which the installed tool does not need afterwards. Without the shared cache, each install downloads its own index.
  • Data files (used by tools like pandoc and hlint) live in the store right next to the binary, so they resolve automatically. There is no copying out of the store and no need for embed_data_files.
  • Running simply puts the tool's bin directory on PATH.

Limitations

  • Compiles from source. First installs can be slow and require the Haskell toolchain. Each tool keeps its own CABAL_DIR, so the build store is not shared across tools (more time and disk than a shared store, in exchange for fully self-contained, relocation-safe installs).
  • Large package index. The first search, listing, or install downloads the Hackage package index (about 140 MB, 1.2 GB on disk) into mise's cache directory, which takes about a minute. Later runs only fetch new uploads. mise cache clear deletes it.
  • Executables only. Library-only Hackage packages (no executable component) are not supported.

Development

This repo is itself a mise project. mise install provisions the dev tooling and the Haskell toolchain.

# Link this checkout as the `mise-cabal` backend for local testing
mise plugin link --force mise-cabal .

# Lint and format (stylua + lua-language-server + actionlint via hk)
mise run lint
mise run lint-fix

Enable pre-commit hooks (optional):

hk install

Debug a single operation:

mise --debug install mise-cabal:hello@latest

Files

  • metadata.lua - plugin metadata (name, depends, notes)
  • hooks/backend_list_versions.lua - lists Hackage versions
  • hooks/backend_search_tools.lua - searches Hackage packages for mise search
  • hooks/backend_install.lua - builds and installs a package
  • hooks/backend_exec_env.lua - puts the tool's bin dir on PATH
  • lib/cabal.lua - runs a command with the tool's isolated CABAL_DIR
  • lib/index.lua - searches and lists versions from the shared Hackage package index
  • lib/hackage.lua - Hackage API fallback for searching and listing
  • mise.toml - dev tooling, Haskell toolchain, and tasks
  • mise-tasks/test - end-to-end test task
  • .github/workflows/ci.yml - CI on Linux, macOS, and Windows

Documentation

License

MIT

About

A mise backend plugin that installs Hackage tools through Cabal.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Contributors

Languages