My dotfiles in Home-manager and Nix.
- Install Nix via Multi-user installation.
- Enable the
nix-commandandflakesfeatures, whichnix buildandnix runneed:
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf- Build and Install this project as follows (the configuration for the current system,
mymacormyubuntu, is selected automatically):
nix build # build only; the result is linked at ./result
./result/activate # switch to the built configurationOr build and switch in one step:
nix runPackage versions are pinned by flake.lock. To update them:
make upgrade # update flake.lock, build, and show the version changes
make switch # activate
git commit flake.lock -m "flake: update inputs"Use make update INPUT=nixpkgs to update one input only, and make help to list all targets.
darwinConfigurations.mymac manages macOS system settings (Dock, Finder, key repeat, Caps Lock → Control, system-wide Nix settings) with nix-darwin.
It doesn't touch the user environment, which still comes from the steps above.
The first time, run nix-darwin from the flake:
sudo nix run nix-darwin -- switch --flake .#mymacAfter that, darwin-rebuild is installed:
sudo darwin-rebuild switch --flake .#mymacAfter installing Emacs through this configuration, you need to reinstall LSP packages with plist support:
- Start Emacs (packages will be installed automatically)
- Run:
M-x lsp-reinstall-packages-for-plists - Restart Emacs
This step is necessary because the configuration uses LSP_USE_PLISTS=true (set in emacs/early-init.el) for better LSP performance. LSP packages must be compiled with this environment variable to avoid hash-table/plist type errors.