srid / srid/haskell-flake

Avoid global caches (hie-bios, cabal)

Open
#160 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation question
Dominant language
Nix
Stars
240
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Can haskell-flake provide a default configuration that stores ~/.cache/cabal and ~/.cache/hie-bios in project-local (gitignore'ed) directories?

Why do we need this? These caches if corrupt or out of date can break the Haskell dev environment. HLS can stop working after macOS upgrade, for instance. To mitigate this "reproducibility" issue, we can configure all these build tools cache to be stored under project root:

{
        devShell.mkShellArgs.shellHook = ''
          export HIE_BIOS_CACHE_DIR=''${FLAKE_ROOT}/Backend/.hie-bios-cache
          export CABAL_DIR=''${FLAKE_ROOT}/Backend/.cabal-dir
        '';
}

Then people can simply run git clean -X to nuke these caches and start a fresh dev env.

But it does require using https://github.com/srid/flake-root and knowing which sub directory the haskell project is on (although the latter can be probably automated using projectRoot option).

At minimum we can document this as recommendation, rather than having haskell-flake do it automatically for users.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing haskell-flake module options and how devShell.mkShellArgs.shellHook is assembled. Compare the proposed HIE_BIOS_CACHE_DIR and CABAL_DIR settings with flake-root and the projectRoot option, then determine whether the result should be an automatic default or documentation recommendation. Done means the chosen behavior is documented or configurable without guessing the Haskell subdirectory.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.