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 -- --versionEach 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 thecabalbinary tool (which you install separately, see below).
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:
[tools]
"cabal" = "latest"
"ghcup" = "latest"
"mise-ghcup:ghc" = "latest"
[plugins]
"vfox:mise-ghcup" = "https://github.com/wasp-lang/mise-ghcup.git"
[settings]
experimental = true # Needed for using backend plugins like mise-ghcup and mise-cabalmise plugin install https://github.com/wasp-lang/mise-cabalIn your mise.toml file:
[plugins]
"vfox:mise-cabal" = "https://github.com/wasp-lang/mise-cabal.git"
[settings]
experimental = true # Needed for using backend plugins like mise-cabalThen you can use it freely:
# 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 -- --versionYou can also add tools directly to a mise.toml:
[tools]
"mise-cabal:pandoc-cli" = "latest"
"mise-cabal:hlint" = "3.8"- Listing (
ls-remote) queries the Hackage JSON API and returns the published versions of the package. - Installing sets
CABAL_DIRto the tool version's own mise install directory and runscabal install <package>-<version>. BecauseCABAL_DIRrelocates cabal's whole home, the build store, package index, and binaries all live inside that directory. - Data files (used by tools like
pandocandhlint) live in the store right next to the binary, so they resolve automatically. There is no copying out of the store and no need forembed_data_files. - Running simply puts the tool's
bindirectory onPATH.
- Compiles from source. First installs can be slow and require the Haskell toolchain. Each tool keeps its own
CABAL_DIR, so the package index and build store are not shared across tools (more time and disk than a shared store, in exchange for fully self-contained, relocation-safe installs). - Executables only. Library-only Hackage packages (no executable component) are not supported.
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-fixEnable pre-commit hooks (optional):
hk installDebug a single operation:
mise --debug install mise-cabal:hello@latestmetadata.lua- plugin metadata (name,depends, notes)hooks/backend_list_versions.lua- lists Hackage versionshooks/backend_install.lua- builds and installs a packagehooks/backend_exec_env.lua- puts the tool's bin dir onPATHlib/cabal.lua- runs a command with the tool's isolatedCABAL_DIRmise.toml- dev tooling, Haskell toolchain, and tasksmise-tasks/test- end-to-end test task.github/workflows/ci.yml- CI on Linux, macOS, and Windows
MIT