To update the system configuration, use one of these commands:
# For NixOS systems (can run as root initially, but long-term should run as user)
sudo nixos-rebuild switch --flake .#nixos --cores 0
# For specific host configurations
sudo nixos-rebuild switch --flake .#kawaiinixos --cores 0
sudo nixos-rebuild switch --flake .#rossnixos --cores 0- Initial Setup: You can run these commands as root during initial setup
- Long-term Usage: Should be run as the user specified in the relevant userdata file from their home directory (
~/dotfiles) - Why User Directory: Some configuration folders expect to be writable by the user, so running from the user's home directory ensures configs work properly
WSL runs Nix on top of an ordinary Ubuntu rootfs, so there is no NixOS or
nix-darwin layer. The john@wsl output is a standalone home-manager
configuration instead (nix/hosts/wsl/home.nix): user-level only, no sudo.
# Bootstrap (home-manager is not installed yet).
# -b backup renames any pre-existing file it would overwrite to <name>.backup
nix run github:nix-community/home-manager -- switch -b backup --flake ~/dotfiles#john@wsl
# Subsequent updates (home-manager installs itself into the profile)
home-manager switch --flake ~/dotfiles#john@wslThree manual steps Nix cannot do for you:
- Generate the
en_US.UTF-8locale on the Ubuntu side. Ubuntu's WSL image ships onlyC/C.UTF-8/POSIX. The host config setsLANG=en_US.UTF-8(home-manager's CLI panics parsingC.UTF-8as a language tag and exits 101, after activation has already succeeded) and provides a NixglibcLocalesviaLOCALE_ARCHIVEfor Nix-built binaries. Ubuntu's own glibc cannot read that archive — different glibc version — so Debian tooling such asperlwarns until the locale also exists system-side:sudo locale-gen en_US.UTF-8
- Retire
~/.gitconfig. home-manager writes~/.config/git/config, and git reads both, with~/.gitconfigtaking precedence — so an existing~/.gitconfigsilently overrides the managed one. Its contents have been folded intonix/hosts/wsl/home.nix, so remove it once you have switched:mv ~/.gitconfig ~/.gitconfig.pre-hm - Set zsh as the login shell. Standalone home-manager cannot call
chsh. Use the~/.nix-profilepath, not the/nix/storeone, so it survives rebuilds:Nix's zsh does not readecho "$HOME/.nix-profile/bin/zsh" | sudo tee -a /etc/shells chsh -s "$HOME/.nix-profile/bin/zsh"
/etc/profile, so/etc/profile.d/nix.sh— which is what puts the Nix profiles onPATHfor bash — never runs in a login zsh. Without help, a login shell has neithernixnorhome-manageronPATH.home.sessionPathin the host config covers this; see the comment there for the ordering rationale.
Notes specific to this host:
- Uses
wsl_packages(headless core) rather thandefault_packages, which dropstexliveFull, the Android SDK andanki-bin. cudaSupport = falseis applied at the flake call site, keeping the CUDALD_LIBRARY_PATH(and its multi-GB closure) out of the WSL profile while leaving the GPU desktop hosts unchanged.- Claude Code is left to its own self-updating native installer; adding
pkgs.claude-codehere would shadow it and pin the version. utilities/ssh/id_ed25519.pubis not linked into~/.ssh. It is a placeholder key (its comment is stillyour_email@example.com, matching the stub inuserdata.authorizedKeys) and does not correspond to any private key on this host, so linking it would clobber a working public key.
The information below is outdated. For current usage, see the updated instructions:
To bootstrap NixOS with my dotfiles, follow these steps:
- Clone the repository to ~/dotfiles under a username matching the username HOME directory defined in configuration.nix
- Change the username defined configuration.nix
- Run
nix flake update ~/dotfiles - Run
~/dotfiles/scripts/switch.sh
sudo nix-collect-garbage --delete-older-than 7d
sudo nix-store --optimiseInstall XCode manually as this cannot currently be automated
then run these commands: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer && sudo xcodebuild -runFirstLaunch
To bootstrap nix on MacOS with my dotfiles, follow these steps:
- Clone the repository to ~/dotfiles
- Change the username defined configuration.nix
- Install Nix on MacOS
sh <(curl -L https://nixos.org/nix/install) - Run
nix flake update ~/dotfiles - Run
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake ~/dotfiles#macbook-m1
After bootstrapping, you can update your system by running ~/dotfiles/scripts/switch.sh
