Skip to content

Nix

Install

Install Determinate Nix
curl -fsSL https://install.determinate.systems/nix | sh -s -- install

Profiles1

nix profile command.

List system profiles
nix profile history
List user nix profiles
ls -l "$XDG_STATE_HOME/nix/profiles"
List root user nix profiles
ls -l "$NIX_STATE_DIR/profiles/per-user/root"

Generations

List system generations
nix-env --list-generations
List Home Manager generations
home-manager generations

Space Management

Expire Home Manager generations
home-manager expire-generations '-3 days'
Clear profiles
nix profile wipe-history --older-than 3d
Garbage collect nix store
nix store gc
Garbage collect nix store
nix store optimise

Nuclear option

Expire all profiles and generations except the current and collect garbage
nix-collect-garbage -d

  1. Profiles and user environments are Nix’s mechanism for implementing the ability to allow different users to have different configurations, and to do atomic upgrades and rollbacks.