Hey, you. You're finally awake. You were trying to configure your OS declaratively, right? Walked right into that NixOS ambush, same as us, and those dotfiles over there.
Good news, traveler! These dotfiles now work on both NixOS and macOS. One config to rule them all, and in the darkness bind them.
# Quick taste of what you're in for:
nix run nix-darwin -- switch --flake ~/.config/dotfiles # macOS
nixos-rebuild switch --flake .#hostname # NixOS
Shell: | zsh + a bunch of Nix magic |
DM: | lightdm + lightdm-mini-greeter |
WM: | bspwm + polybar (Linux) / Aerospace (macOS) |
Editor: | Doom Emacs (and nvim when Emacs is napping) |
Terminal: | st (Linux) / Ghostty (macOS) |
Launcher: | rofi (Linux) / Raycast (macOS) |
Browser: | firefox / Zen Browser / Orion (I collect browsers) |
GTK Theme: | Ant Dracula |
- Acquire NixOS 24.11 (or close enough).
- Boot into the installer.
- Do your partitions and mount your root to
/mnt
(or don't, I'm not your supervisor) git clone https://github.com/emiller88/dotfiles /etc/nixos
- Install NixOS:
nixos-install --root /mnt --flake /etc/nixos#XYZ
, whereXYZ
is your hostname. Use#generic
for a simple, universal config. - OPTIONAL: Create a sub-directory in
hosts/
for your device. See host/kuro as an example. - Reboot!
- Install Nix using the Determinate Systems installer (it's like the official installer, but actually works):
Why this installer? It handles macOS quirks, enables flakes by default, and won't leave you troubleshooting for hours.
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
git clone https://github.com/emiller88/dotfiles ~/.config/dotfiles
cd ~/.config/dotfiles
./bin/hey re
(or ifhey
isn't in your PATH yet:nix run .#darwinConfigurations.HOSTNAME.system.build.darwin-rebuild -- switch --flake .
)- Use
MacTraitor-Pro
orSeqeratop
for HOSTNAME, or checkflake.nix
for available configs
- Use
- Grab a coffee while Nix downloads the internet
sudo ./result/sw/bin/darwin-rebuild --flake .#HOSTNAME switch
when prompted
And I say, bin/hey
. What's going on?
Command | Description |
---|---|
hey rebuild |
Rebuild this flake (shortcut: hey re ) |
hey upgrade |
Update flake lockfile and switch to it (shortcut: hey up ) |
hey rollback |
Roll back to previous system generation |
hey gc |
Runs nix-collect-garbage -d . Use sudo to clean system profile |
hey push REMOTE |
Deploy these dotfiles to REMOTE (over ssh) |
hey check |
Run tests and checks for this flake |
hey show |
Show flake outputs of this repo |
-
How do I change the default username?
- Set
USER
the first time you runnixos-install
:USER=myusername nixos-install --root /mnt --flake #XYZ
- Or change
"emiller"
in modules/options.nix (was"hlissner"
in the before times). - For macOS: just make sure your username matches what's in the flake
- Set
-
How do I "set up my partitions"?
My main host has a README you can use as a reference. I set up an EFI+GPT system and partitions with
parted
andzfs
.macOS users: You can skip this part and feel smug about it.
-
Why is my build failing with homebrew errors?
That's just homebrew being homebrew. The build succeeded, you just need to run the activation with sudo. Check the message at the end of
hey re
. -
How 2 flakes?
It wouldn't be the NixOS experience if I gave you all the answers in one, convenient place. But basically: everything is a flake now, resistance is futile.
Add dotfiles to your flake.nix
:
{
inputs.dotfiles.url = "https://flakehub.com/f/Emiller88/dotfiles/*.tar.gz";
outputs = { self, dotfiles }: {
# Use in your outputs
};
}