Dotfile management using nix, home-manager, and stow.
- install nix
- add the
home-manager
channel:nix-channel --add https://github.com/nix-community/home-manager/archive/<RELEASE>.tar.gz home-manager
- find the release from the github; it will be in the form
release-23.11
- find the release from the github; it will be in the form
nix-shell -p stow
Get ssh sorted
Neovim uses the .config
directory
$ pwd
> doots
Doublecheck what stow
will do:
stow --adopt -nv
If it looks good, remove the -n
and run:
stow --adopt -v
cd machines
sudo stow --target=/etc/nixos <machine>
mkdir $HOME/.nixpkgs
cd machines
sudo stow --target $HOME/.nixpkgs uncompahgre
Install nix-darwin
The installer should rebuild switch, but if not exit or source the shell and darwin-rebuild switch
- Add channel:
nix-channel --add <channel-url> <channel-name>
- Go to the repo and find the right release branch name for the target architecture, e.g.
nixpkgs-24.05-darwin
for darwin- For example:
nix-channel --add https://nixos.org/channels/nixpkgs-24.05-darwin nixos
- For example:
- Add the main channel and call it
nixos
- Add the unstable channel and call it
unstable
- Go to the repo and find the right release branch name for the target architecture, e.g.
- Update channels:
nix-channel --update
- (Optional for darwin)
nix-channel --update darwin
- Darwin: build/activate:
darwin-rebuild switch
- Update
nixpkgs
version:nix-channel --add <new-version-url> nixpkgs
- Format:
nixpkgs-fmt ./path/to/file
- Garbage collect the store:
nix-collect-garbage
(-d
to delete old profiles/generations for extra cleanup; see manpage)
man home-configuration.nix