nix#
This is a project with my nix configuration for a MacBook (darwin).
Installation#
Download Nix with Determinate Systems and decline the --determinate option with "no" (you will be prompted):
curl -fsSL https://install.determinate.systems/nix | sh -s -- install
Install homebrew separately with this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Since git is configured with this repo, I recommend that you just download the ZIP of the repo and unpack locally, save it to ~/.config/nix/ and execute:
sudo nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ~/.config/nix#shai-hulud
After that command, nix-darwin is installed and you can run this command to rebuild your config:
sudo darwin-rebuild switch --flake ~/.config/nix
Afterwards, this alias will be available to rebuild your config:
sudo nix-switch
Troubleshooting#
dotfiles#
If your home-manager configuration files are not getting applied, the issue could be some messed up permissions of your .local folder, check them with:
ls -ld ~/.local
If those are not owned by you but maybe root instead, change the permissions and run the rebuild again:
sudo chown -R trueberryless:staff ~/.local
alias#
Be careful which user runs commands and which config file these users will use to get available aliases. For example, the nix-switch alias in this repo allows the root user to run the alias, as it uses the $SUDO_USER to find the folder of the user which executes the command (in this case trueberryless). It is not possible to simply define aliases for root inside home-manager.nix as the sudo user uses a different .zshrc file.
Resources#
I want to express my heartfelt gratitude to everyone who contributes to the Nix ecosystem.
Blog posts and documentation#
- NixOS & Flakes Book - An unofficial book for beginners - Ryan Yin
- Blog: "Managing dotfiles on macOS with Nix" - Davis Haupt