Environment Variables

Environment variables for configuring hx behavior.

General Settings

HX_HOME

Override the hx home directory:

export HX_HOME="$HOME/.hx"

Default:

  • Linux: ~/.local/share/hx
  • macOS: ~/Library/Application Support/hx
  • Windows: %APPDATA%\hx

HX_CACHE_DIR

Override the cache directory:

export HX_CACHE_DIR="$HOME/.cache/hx"

Default:

  • Linux: ~/.cache/hx
  • macOS: ~/Library/Caches/hx
  • Windows: %LOCALAPPDATA%\hx\cache

HX_CONFIG_DIR

Override the config directory:

export HX_CONFIG_DIR="$HOME/.config/hx"

HX_LOG

Set logging level:

export HX_LOG=debug  # trace, debug, info, warn, error

HX_LOG_FORMAT

Set log format:

export HX_LOG_FORMAT=json  # text, json

Build Settings

HX_JOBS

Default parallel jobs:

export HX_JOBS=8

Overridden by --jobs flag and [build].jobs config.

HX_RELEASE

Build in release mode by default:

export HX_RELEASE=1

HX_GHC_OPTIONS

Additional GHC options:

export HX_GHC_OPTIONS="-Wall -Werror"

Toolchain Settings

HX_GHC

Override GHC executable:

export HX_GHC=/opt/ghc/9.8.2/bin/ghc

HX_CABAL

Override Cabal executable:

export HX_CABAL=/opt/cabal/3.10/bin/cabal

HX_BHC

Override BHC executable:

export HX_BHC=/opt/bhc/0.2.0/bin/bhc

HX_GHCUP

Override GHCup executable:

export HX_GHCUP=/usr/local/bin/ghcup

Output Settings

NO_COLOR

Disable colored output:

export NO_COLOR=1

CLICOLOR

Enable/disable color:

export CLICOLOR=1     # Enable
export CLICOLOR=0     # Disable

CLICOLOR_FORCE

Force colored output (even in non-TTY):

export CLICOLOR_FORCE=1

HX_COLOR

Control color output:

export HX_COLOR=always  # always, auto, never

HX_PROGRESS

Show/hide progress indicators:

export HX_PROGRESS=1   # Show progress
export HX_PROGRESS=0   # Hide progress

Network Settings

HX_OFFLINE

Offline mode (no network requests):

export HX_OFFLINE=1

HTTP_PROXY / HTTPS_PROXY

Proxy settings:

export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080

HX_HACKAGE_SERVER

Override Hackage server:

export HX_HACKAGE_SERVER=https://hackage.haskell.org

CI Detection

CI

hx detects CI environments:

export CI=true

In CI mode:

  • Progress indicators are simplified
  • Prompts are disabled
  • Timestamps are added to output

GITHUB_ACTIONS

Detected automatically:

# GitHub Actions - auto-detected
- run: hx build

Path Settings

PATH

Ensure toolchains are in PATH:

export PATH="$HOME/.ghcup/bin:$PATH"
export PATH="$HOME/.bhc/bin:$PATH"

Debugging

HX_DEBUG

Enable debug mode:

export HX_DEBUG=1

Shows:

  • Full command invocations
  • Timing information
  • Detailed error messages

HX_TRACE

Enable tracing (very verbose):

export HX_TRACE=1

RUST_BACKTRACE

Show Rust backtraces on panic:

export RUST_BACKTRACE=1

Shell Configuration

Bash

Add to ~/.bashrc:

# hx configuration
export PATH="$HOME/.ghcup/bin:$PATH"
export HX_LOG=info

# Shell completions
eval "$(hx completions bash)"

Zsh

Add to ~/.zshrc:

# hx configuration
export PATH="$HOME/.ghcup/bin:$PATH"
export HX_LOG=info

# Shell completions
eval "$(hx completions zsh)"

Fish

Add to ~/.config/fish/config.fish:

# hx configuration
set -gx PATH $HOME/.ghcup/bin $PATH
set -gx HX_LOG info

# Shell completions
hx completions fish | source

Docker/Container Usage

FROM haskell:9.8

# Install hx
RUN curl -fsSL https://get.arcanist.sh/hx | sh

# Configure for container environment
ENV HX_LOG=info
ENV HX_PROGRESS=0
ENV CI=true

See Also