Synchronize dependencies from the lockfile.
Synopsis
hx sync [OPTIONS]Description
The sync command installs dependencies according to hx.lock, ensuring your local environment matches the locked versions exactly.
Options
--force Reinstall all dependencies
--offline Use only cached packages
--check Verify sync without installing
-v, --verbose Show detailed outputExamples
Sync Dependencies
hx syncForce Reinstall
hx sync --forceOffline Mode
# Use only locally cached packages
hx sync --offlineCheck Without Installing
hx sync --checkWhen to Sync
Run hx sync when:
- Cloning a project with
hx.lock - Checking out a different branch
- After pulling changes to
hx.lock - After modifying
hx.lockmanually
Typical Workflow
New Clone
git clone https://github.com/example/project
cd project
hx sync
hx buildBranch Switch
git checkout feature-branch
hx sync # Install branch's dependencies
hx buildAfter Pull
git pull
hx sync # Install updated dependencies
hx buildWhat It Does
- Reads hx.lock for exact versions
- Downloads packages from Hackage (if needed)
- Verifies checksums against lockfile
- Installs packages to local store
- Configures build to use locked versions
Lockfile Required
hx sync requires hx.lock to exist:
error: hx.lock not found
fix: Run `hx lock` to generate a lockfileOffline Mode
For air-gapped environments:
# First, on a connected machine:
hx sync # Downloads all packages
# Later, on disconnected machine:
hx sync --offlinePackages are cached in:
- Linux:
~/.cache/hx/packages - macOS:
~/Library/Caches/hx/packages - Windows:
%LOCALAPPDATA%\hx\packages
CI Usage
- name: Install dependencies
run: hx sync
- name: Build
run: hx build
- name: Test
run: hx test