This repository contains the configuration for $HOME
as well as some other things to fine-tune my macOS experience.
Most of it is managed with nix and home-manager.
Make sure you have your development tools installed. Running xcode-select --install
in your terminal should work just fine, or you could install Xcode in full.
There are several ways to install Nix. You can use the official installer or use the one from determinate systems.
Either one is fine. The one from Determinate Systems has some quality-of-life improvements, such as:
- survives macOS updates (see NixOS/nix#3616)
- doesn't configure channels and enables flake support by default
- offers a built-in way to uninstall Nix
If you went with the official installer, make sure that the experimental-features
is set to flakes nix-command repl-flake
. You can check by running:
nix show-config
If experimental-features
is not set or does not contain flakes
and nix-command
, set them by configuring Nix:
mkdir -p ~/.config/nix
cat <<EOF >> ~/.config/nix/nix.conf
experimental-features = flakes nix-command
EOF
Finally, restart the Nix daemon:
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon
Warning: This repository contains my configuration and is specifically tuned to my workflow. Read the source before blindly following along!
Now that we have both our development tools and the nix package manager installed, it's time to clone this repository:
git clone [email protected]:kevinbungeneers/dotfiles.git ~/.dotfiles
Install home-manager and activate the configuration:
cd ~/.dotfiles/home-manager
nix run home-manager -- switch --flake .
Tip: To save yourself a few keystrokes you could symlink the home-manager directory to
~/.config/home-manager
. This way you won't need to pass thedir
option when invoking the switch command:ln -s ~/.dotfiles/home-manager ~/.config/home-manager home-manager switch
Going through System Settings and dragging icons in and out of the dock is a bit too tedious for my taste. That's why I created a little script that configures the dock just the way I like:
cd ~/.dotfiles/dock
./configure.zsh
My terminal emulator of choice is the one that's included with the OS. I've added a custom terminal configuration, based on this one.
Both the home-manager
and nixpkgs
inputs are pinned to a specific version in the flake.lock
file.
Updating these are just a simple command away:
nix flake update
Alternatively you could also update a single input:
nix flake update nixpkgs
Much like a home, dotfiles are never finished. Occasionally you'll want to switch things up and add, replace or remove tooling and/or configuration options. Any changes you've made will need to be activated. From within your home-manager directory:
home-manager -- switch --flake .
Activating a new generation does not update programs or tools.
Note: If your home configuration is named like <user>
, home-manager will automatically pick the right configuration to apply. Otherwise, you'll need to specify your configuration explicitly, like so: home-manager switch --flake ".#<name-of-your-configuration>
With each switch you execute, home-manager will create a new "generation". If you were to break something, you could easily perform a rollback to a previous generation.
List all generations:
home-manager generations
Activating a specific generation:
/nix/store/jyjpp3glrv202sck83y04ji0cl538rjn-home-manager-generation/activate
As time goes by and the number of generations grows, your nix store will inevitably grow too. Running nix store gc
won't be as effective, as those binaries are still linked to a home-manager generation.
This is why it's a good idea to remove some older generations from time to time. You can either remove specific generations by doing:
home-manager remove-generations 1 2
Or, remove generations that are older than 30 days:
home-manager expire-generations "-30 days"