Personal Home Manager configuration for a Nix-based development environment. The flake provides a shared configuration plus optional Sway and Waybar settings for several hosts.
- Reproducible command-line and development tools from a pinned
flake.lock - Modular configuration for Fish, Git, Neovim, SSH, tmux, and other tools
- Host-specific Sway configuration with a shared fallback
- Formatting checks through
nix flake check
- A 64-bit Linux system (
x86_64-linux) - Nix with the
nix-commandandflakesexperimental features enabled - Git
Install Nix by following the official installation instructions. For a multi-user installation, ensure the Nix daemon is running before continuing.
Enable flakes if they are not already enabled:
mkdir -p ~/.config/nix
grep -qxF 'extra-experimental-features = nix-command flakes' ~/.config/nix/nix.conf 2>/dev/null || \
printf '%s\n' 'extra-experimental-features = nix-command flakes' >> ~/.config/nix/nix.confClone the repository:
git clone https://github.com/mycroft/nix-home-env.git ~/.config/home-manager
cd ~/.config/home-managerChoose the configuration matching the machine:
| Host | Desktop configuration |
|---|---|
mycroft |
Base configuration only |
glitter |
Sway and Waybar, with host-specific Sway settings |
quantum |
Sway and Waybar, using the default Sway host settings |
relax |
Sway and Waybar, with host-specific Sway settings |
nee |
Sway and Waybar, with host-specific Sway and Electron settings |
Apply it by replacing <host> with one of the names above:
nix run github:nix-community/home-manager -- switch --flake ".#<host>" -b backupThe -b backup option moves files that would otherwise conflict with Home Manager. After the first successful installation, use the installed command for subsequent updates:
home-manager switch --flake ".#<host>"Enter the development shell to install the formatter and Git pre-commit hook:
nix developFormat Nix files:
nix fmtRun the flake checks:
nix flake checkTo let Home Manager control the login shell, add the generated Fish executable to /etc/shells and select it with chsh. Login shells should load these generated environment scripts automatically:
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh/etc/profile.d/nix-daemon.fishfor a multi-user Nix installation
For a single-user installation:
source "$HOME/.nix-profile/etc/profile.d/nix.fish"For a multi-user installation:
source /etc/profile.d/nix-daemon.fishHome Manager writes the configured public keys to ~/.ssh/authorized_keys.nix. Install them with the required permissions:
cp ~/.ssh/authorized_keys.nix ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keysReview the generated file before replacing an existing authorized_keys file.
List and expire old Home Manager generations:
home-manager generations
home-manager expire-generations '-7 days'Collect unused Nix store paths:
nix-store --gc- Nix manual — Nix commands and configuration
- Home Manager manual — Home Manager options and usage