Install Apus declaratively with nix-apus, the first-party, batteries-included Home Manager module.

The nix-apus repo is the source of truth for Nix installation. This page is a quick overview.

What you get

Quick start

Install Determinate Nix

If Nix is not already installed, follow the [Determinate Nix installer](https://github.com/DeterminateSystems/nix-installer) instructions.

Create a local flake

Use the agent-first template from the nix-apus repo:
```bash
mkdir -p ~/code/apus-local
git clone https://github.com/openclaw/nix-openclaw.git /tmp/nix-apus
cp /tmp/nix-apus/templates/agent-first/flake.nix ~/code/apus-local/flake.nix
```

Configure secrets

Set up your messaging bot token and model provider API key. Plain files at `~/.secrets/` work fine.

Fill in template placeholders and switch

```bash
home-manager switch
```

Verify

Confirm the launchd service is running and your bot responds to messages.

See the nix-apus README for full module options and examples.

Nix-mode runtime behavior

When APUS_NIX_MODE=1 is set (automatic with nix-apus), Apus enters a deterministic mode for Nix-managed installs. Other Nix packages can set the same mode; nix-apus is the first-party reference.

For externally managed config without Nix, use APUS_CONFIG_READONLY=1. It applies the same immutable-config enforcement with generic messaging, without enabling Nix-specific behavior. Existing APUS_NIX_MODE=1 installs need no changes.

You can also set it manually:

export APUS_NIX_MODE=1

On macOS, the GUI app does not inherit shell environment variables. Enable Nix mode via defaults instead:

defaults write ai.apus.mac apus.nixMode -bool true

What changes in Nix mode

Config and state paths

Apus reads JSON5 config from APUS_CONFIG_PATH and stores mutable data in APUS_STATE_DIR. Under Nix, set these explicitly to Nix-managed locations so runtime state and config stay out of the immutable store.

Variable Default
APUS_HOME HOME / USERPROFILE / os.homedir()
APUS_STATE_DIR ~/.apus
APUS_CONFIG_PATH $APUS_STATE_DIR/apus.json

Service PATH discovery

The launchd/systemd gateway service auto-discovers Nix-profile binaries so plugins and tools that shell out to nix-installed executables work without manual PATH setup:

This applies to both macOS launchd and Linux systemd service environments.

Related

nix-apus

Source-of-truth Home Manager module and full setup guide.

Setup wizard

Non-Nix CLI setup walkthrough.

Docker

Containerized setup as a non-Nix alternative.

Updating

Updating Home Manager-managed installs alongside the package.