Determines the state directory (which e.g. holds the hackage tarball) cabal-install uses via the following logic:
If the
CABAL_DIRenvironment variable is set, its content is used as the cabal state directoryIf
~/.cabal(see getAppUserDataDirectory) exists, use that.Otherwise, use
${XDG_CACHE_HOME}/cabal(seegetXdgDirectory XdgCache) which is the new directory cabal-install can use starting with version3.10.*.
This logic is mostly equivalent to what upstream cabal-install is doing with the following exception: The state directory can freely be configured to use a different location in the cabal-install configuration file. hackage-db doesn't parse this configuration file, so differing state directories are ignored.