This repository contains Adam Whitlock's personal home-manager configuration for managing dotfiles and system configurations.
This configuration uses Flox for package management rather than home-manager's package management capabilities. While home-manager handles dotfiles and program configurations, all package installation and updates are managed through Flox commands (flox install
, flox update
, etc.). This separation provides more direct control over package management and allows for easier package state management across different systems. Home-manager's package management is intentionally disabled in this setup - if you need to install a new package, use flox install package-name
instead of adding it to home-manager's configuration.
I have added additional documentation for how to use Nix for installing home-manager. With that stated, nothing prevents you from using these configurations and Nix packages anyway you want.
You either need to have a working Nix (Nix Packages) setup OR something that can manage the dependencies for Nix. I've provided a couple different options for management. Right now, I'm playing with Flox so the Flox version will work.
- First, ensure you have Nix installed. If not, install it:
sh <(curl -L https://nixos.org/nix/install) --daemon
- Add the home-manager channel:
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
- Install home-manager:
nix-shell '' -A install
- Restart your shell or source your profile:
. $HOME/.nix-profile/etc/profile.d/nix.sh
- Verify the installation:
home-manager --version
-
Visit Flox Installation Guide and follow the installation instructions for your operating system.
-
After installation, add Flox to your
.bashrc
:
# Enable Flox
eval $(flox activate)
- Restart your shell or source your
.bashrc
:
source ~/.bashrc
- Pulling Configuration via Floxhub (optional)
To use the Flox configuration from FloxHub, you can pull it directly using the following command:
flox pull alloydwhitlock/default
- Install Home Manager
With Flox installed, install home-manager using your default environment:
flox install home-manager
Here's the basic configuration structure, showing how it's setup. This may differ over time from the actual structure:
~/.config/home-manager/
├── home.nix # Main configuration entry point
└── profiles
├── default.nix # Profile selection logic
├── default/ # Base profile (always loaded)
│ ├── default.nix
│ ├── packages.nix
│ └── programs/
│ ├── alacritty.nix
│ ├── git.nix
│ ├── tmux.nix
│ └── vim.nix
└── work/ # Work profile (adds to defaults unless specified)
├── default.nix
├── packages.nix
└── programs/
└── work-specific.nix
The configuration supports multiple profiles:
- default: Base configuration used everywhere
- work: Additional work-specific configurations, like Git config
To switch between profiles, use the HM_PROFILE
environment variable before running home-manager:
For normal use:
HM_PROFILE=default home-manager switch
For work profile:
HM_PROFILE=work home-manager switch
To make this easier, you can add these as aliases to your shell configuration:
alias hm-default='HM_PROFILE=default home-manager switch'
alias hm-work='HM_PROFILE=work home-manager switch'
You can also set it permanently in your shell configuration or use environment detection:
# Add to your .bashrc or .zshrc
export HM_PROFILE="default"
# Check if home directory named/contains "adamwhitlock" or has .work file
if [[ "$HOME" == *"adamwhitlock"* ]] || [ -f "$HOME/.work" ]; then
export HM_PROFILE="work"
fi
To verify which profile is active:
echo $HM_PROFILE
- Clone this repository
git clone <repository-url> ~/.config/dotfiles
- Create a symlink for home-manager
ln -s "$HOME/.config/dotfiles/.config/home-manager" "$HOME/.config/home-manager"
- Initial home-manager build & activation:
home-manager switch
- Edit configuration files as needed
- Apply changes:
home-manager switch
- Create a new configuration file in the appropriate profile directory
- Import it in the profile's
default.nix
- Apply changes with
home-manager switch
- Files already exist: Use backup flag
home-manager switch -b backup
- Check configuration:
home-manager build
- Show trace for errors:
home-manager switch --show-trace
To verify which profile is active:
echo $HM_PROFILE
- The default profile is always loaded
- Work profile adds to (doesn't replace) the default profile
- Configuration changes require running
home-manager switch
- Keep backups of important configurations before major changes
- 2024.11.29 - Massive rewrite, removed all original configuration files, pushed into using Home Manager (Nix)
- 2021.01.18 - Added .bashrc options for modernizing (Pop!_OS compatability), .vimrc cleanup. Removed unused Molokai theme, added Alacritty config
- 2018.04.22 - Removed Vundle plugin support from dotfiles, added show/hide status for .tmux.conf, notes for using GNU Stow (thanks to Kyle Reid for the inspiration)
- 2017.03.28 - Fixed .tmux.conf to support newer tmux directives for mouse & UDF
- 2017.03.27 - Added Vundle plugin support, .vimrc improvements for Python development
- 2016.11.04 - Added history options, .bash_profile, .gitconfig
- 2016.09.08 - Modified Bash prompt to include relative directory path
- 2016.08.10 - Added Molokai theme for Vim
- 2016.07.17 - Creation and initial commit of basic dotfiles