Nix health

From juspay/skills · View interactive version

Nix health is an AI agent skill from the GitHub repository juspay/skills. Use this when diagnosing or fixing a user's Nix installation — checks flakes, version, caches, max-jobs, direnv, rosetta, trusted-users, and shell config

How to use this skill

Skill file

Nix Health Checks

Run these checks to diagnose problems with a Nix installation. For each failing check, report the issue and suggestion to the user.

1. Nix Installer

Identify which installer was used:

# NixOS/nix-installer and Determinate Nix both leave a receipt:
cat /nix/receipt.json 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin).get('version','unknown'))" 2>/dev/null

# On macOS, check launchd service names:
ls /Library/LaunchDaemons/*nix* /Library/LaunchDaemons/*determinate* 2>/dev/null

# On Linux, check systemd:
systemctl list-units '*nix*' '*determinate*' --no-pager 2>/dev/null

# Check for determinate-nixd (Determinate Nix specific):
which determinate-nixd 2>/dev/null

2. Flakes Enabled

nix config show 2>/dev/null | grep '^experimental-features'

Value must contain both flakes and nix-command. If missing:

3. Nix Version

nix --version

Version must be ≥ 2.16.0. If older:

4. Max Jobs

nix config show 2>/dev/null | grep '^max-jobs'

Value must be > 1 (ideally auto). If set to 1:

5. Caches

nix config show 2>/dev/null | grep '^substituters'

Must include https://cache.nixos.org. Also check for project-specific caches defined in:

If any required caches are missing from the user's substituters:

6. Trusted Users

nix config show 2>/dev/null | grep '^trusted-users'
whoami

The current user (or a group they belong to, or *) should appear in trusted-users. If missing:

7. Direnv

which direnv 2>/dev/null && readlink -f "$(which direnv)"

Direnv should be installed and its resolved path should be inside /nix/store/. If not installed or installed outside Nix:

8. Rosetta (macOS only)

Only check on Apple Silicon Macs:

sysctl -n sysctl.proc_translated 2>/dev/null

If the value is 1, Nix is running under Rosetta emulation which slows builds:

9. Homebrew (macOS only)

which brew 2>/dev/null

If Homebrew is installed, flag as ⚠️ — it can interfere with Nix environments (e.g. conflicting library paths, shadowed binaries).

10. Shell Dotfiles

Check if shell config files are managed by Nix (symlinked into /nix/store):

# For zsh:
ls -la ~/.zshrc ~/.zshenv ~/.zprofile ~/.zlogin ~/.zlogout 2>/dev/null
# For bash:
ls -la ~/.bashrc ~/.bash_profile ~/.profile 2>/dev/null

Any dotfile whose resolved path is not under /nix/store/ is unmanaged — flag it as ⚠️.

Reporting

Present results as a table with columns: Check, Status (✅/❌/⚠️), Details, and Suggestion (if failing). Mark checks that don't apply to the current OS as skipped.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.