dotfiles.nix
This repository contains a Nix file,
pepicrft.nix
,
that I use to provision the environments from where I work.
Set it up
- Install Nix:
sh <(curl -L https://nixos.org/nix/install) --daemon
. - Enable flakes:
mkdir -p ~/.config/nix
cat <<EOF >> ~/.config/nix/nix.conf
experimental-features = nix-command flakes
EOF
- Restart the Nix daemon:
sudo launchctl kickstart -k system/org.nixos.nix-daemon
- Install a tool to create a profile:
nix-env -i comma
. - Create a symlink at
~/.config/nixpkgs
that points to the repository directory:
ln -s {path-to-repo} ~/.config/nixpkgs
- Run
nix run . switch
in the repository directory. - Update iTerm's Command setting under the Profile tab to use the custom shell:
~/.nix-profile/bin/zsh
- Update the VSCode settings to use the ZSH managed by Nix:
{
"editor.inlineSuggest.enabled": true,
"terminal.integrated.profiles.osx": {
"Nix-managed ZSH": {
"path": "/Users/pepibumur/.nix-profile/bin/zsh"
}
},
"terminal.integrated.defaultProfile.windows": "Nix-managed ZSH"
}
Troubleshooting
Nix breaks on macOS updates
Add the following to the /etc/zshrc
file:
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
Useful commands
nix run . switch
: Run it whenever we change something in the home manager configuration.nix flake update
: Update the programs in the dependency graph and reflect the updates in the lockfile.