Search code examples
windowshaskellconfiguration-filescabal

Path variables in cabal configuration file


On Windows, I want to change the default per-user installation directories of cabal. The relevant part of the config file is:

install-dirs user
  prefix: C:\path\to\my\folder
  -- bindir: $prefix\bin
  -- libdir: $prefix
  -- libsubdir: $abi\$libname
  -- libexecdir: $prefix\$libname
  -- datadir: $prefix
  -- datasubdir: $abi\$pkgid
  -- docdir: $datadir\doc\$abi\$pkgid
  -- htmldir: $docdir\html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix\etc

What are $abi and $pkgid ? They are not defined in the config file. Does cabal have a default value for these variables (which ones) ? How/where can I define them ?

Edit

@Sibi's answer is perfect. Just to complete the information, I also modified these parameters:

remote-repo-cache: C:\path\to\my\folder\packages
logs-dir: C:\path\to\my\folder\logs
world-file: C:\path\to\my\folder\world
build-summary: C:\path\to\my\folder\logs\build.log

Solution

  • You can refer here to get more details on them.

    $abi corresponds to AbiVar type.

    $pkgid corresponds to PkgIdVar type.

    They are not defined in the config file. They will be generated by Cabal during the build steps depending on your architecture etc. You can see this guide to understand the installation paths.

    For my Linux system, their values are:

    $abi is x86_64-linux-ghc-7.10.3

    $pkgid refers to package name along with it's version. Example: array-1.2.3.4

    But if you want to change the location, my advise would be to just change the prefix path as that is the root installation folder. Everything else will be relative to that.