Nix profile

From meowgorithm/dotfiles · View interactive version

Nix profile is an AI agent skill from the GitHub repository meowgorithm/dotfiles. Manage Nix profiles using the modern `nix profile` command (experimental, replaces `nix-env`). Use when installing, removing, upgrading, or managing packages with Nix flakes.

How to use this skill

Skill file

Nix Profile

Manage Nix profiles using the modern nix profile command (experimental,

replaces nix-env).

Overview

nix profile is the modern, flake-native way to manage Nix profiles. It

replaces the older nix-env command with a more intuitive interface built

around flakes.

Warning: Once you use nix profile, you cannot use nix-env on the same

profile without first deleting it.

Profile Location

Profiles are stored at:

The active profile is symlinked at:

Commands

Install a package

nix profile add nixpkgs#hello
nix profile add nixpkgs/release-23.11#hello
nix profile add nixpkgs/d73407e8e6002646acfdef0e39ace088bacc83da#hello
nix profile add nixpkgs#bash^man          # specific output

Alias: nix profile install (same as add)

List installed packages

nix profile list

Shows:

Remove packages

nix profile remove hello                  # by name
nix profile remove --all                  # remove everything
nix profile remove --regex '.*vim.*'      # by regex
nix profile remove /nix/store/...-hello   # by store path

Upgrade packages

nix profile upgrade hello                 # upgrade specific package
nix profile upgrade --all                 # upgrade everything
nix profile upgrade --regex '.*vim.*'     # upgrade matching packages

Note: Only works with unlocked flake references (e.g., nixpkgs#hello). Locked references (full git rev) won't upgrade.

View profile history

nix profile history

Shows changes between profile versions (additions, removals, upgrades).

Roll back changes

nix profile rollback                      # roll back to previous version
nix profile rollback --to 510             # roll back to specific version

Show closure differences

nix profile diff-closures

Shows detailed differences between profile versions including all dependencies.

Clean up old versions

nix profile wipe-history                  # delete all non-current versions
nix profile wipe-history --older-than 30d # delete versions older than 30 days
nix profile wipe-history --dry-run        # preview what would be deleted

Common Options

Migration from nix-env

If you need to go back to nix-env:

# Warning: this deletes all installed packages
rm -rf "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/profile"

Key Differences from nix-env

| Feature | nix-env | nix profile |

| --------------- | --------------------------- | ------------------------------- |

| Flake-native | No | Yes |

| Profile format | manifest.nix | manifest.json |

| Install command | nix-env -iA nixpkgs.hello | nix profile add nixpkgs#hello |

| Remove by name | nix-env -e hello | nix profile remove hello |

| Upgrade | nix-env -u | nix profile upgrade --all |

| List | nix-env -q | nix profile list |

Filesystem Layout

~/.local/state/nix/profiles/
├── profile -> profile-7-link                    # current profile symlink
├── profile-5-link -> /nix/store/...-profile     # old version
├── profile-6-link -> /nix/store/...-profile     # old version
└── profile-7-link -> /nix/store/...-profile     # current version

Each profile version contains:

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.