LinuxCommandLibrary

home-manager

Nix-based declarative user environment manager

TLDR

Apply home configuration from default location

$ home-manager switch
copy
Apply a specific flake configuration
$ home-manager switch --flake [.#username]
copy
Build without activating
$ home-manager build
copy
List generations (configuration history)
$ home-manager generations
copy
Rollback to previous generation
$ home-manager rollback
copy
Remove old generations
$ home-manager expire-generations "[30 days ago]"
copy
Edit configuration file
$ home-manager edit
copy
Show news about configuration changes
$ home-manager news
copy

SYNOPSIS

home-manager [options] command [args]

DESCRIPTION

home-manager is a Nix-based tool for managing user environment configuration declaratively. It handles dotfiles, user packages, and environment settings through Nix expressions, enabling reproducible and versionable home directory setups.
Configuration is written in Nix language, typically in ~/.config/home-manager/home.nix or as part of a Nix flake. The configuration declares packages to install, programs to configure, files to manage, and services to run.
Many programs have dedicated Home Manager modules that generate configuration files automatically. For example, configuring programs.git generates ~/.gitconfig with proper syntax. This is more maintainable than managing dotfiles manually.
Generations provide configuration history. Each switch creates a new generation, and you can roll back to any previous state. This makes experimentation safe - broken configurations can be reverted instantly.
Home Manager can run standalone or integrate with NixOS. In standalone mode, it manages the user environment independently. With NixOS, it can be imported as a module for tighter integration.

PARAMETERS

switch

Build and activate new configuration.
build
Build configuration without activating.
generations
List all configuration generations.
rollback
Revert to previous generation.
expire-generations period
Remove generations older than period.
remove-generations IDs
Remove specific generations by ID.
edit
Open configuration in $EDITOR.
news
Show news entries about configuration.
packages
List installed packages.
option name
Show value of configuration option.
--flake flake-uri
Use flake-based configuration.
-f, --file file
Configuration file path.
-A attribute
Attribute to build from configuration.
-n, --dry-run
Show what would be done without doing it.
-v, --verbose
Increase verbosity.

CONFIGURATION

~/.config/home-manager/home.nix

Primary configuration file for standalone Home Manager installations. Defines packages, programs, files, and services to manage.
flake.nix
Flake-based configuration entry point when using Home Manager with Nix flakes.
~/.config/home-manager/flake.nix
Default location for flake-based Home Manager configuration.
NIX_PATH
Environment variable used to locate Nix channels for non-flake configurations.

CAVEATS

Requires Nix package manager. Learning curve for Nix language. Some program configurations may conflict with manually managed dotfiles. Flake-based configs need experimental features enabled. Generation management requires manual cleanup to prevent disk usage growth.

HISTORY

Home Manager was created by Robert Helgesson (rycee) around 2017 to bring NixOS's declarative configuration approach to user home directories. It filled a gap for users who wanted Nix's reproducibility for their personal environment without running NixOS. The project has grown to include modules for hundreds of programs.

SEE ALSO

nix(1), nix-env(1), nixos-rebuild(8), chezmoi(1), stow(8)

> TERMINAL_GEAR

Curated for the Linux community

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50