This is my personal Nix configuration repository for macOS. It includes all the packages and configuration files I use on my system, managed by Nix, using a Nix Flake.
"Defining the whole configuration of a system in code is a revolutionary concept, and it's a really powerful one." - Jessica Kerr
- Install nix
curl -L https://nixos.org/nix/install | sh
mkdir -p ~/.config/nix
cat <<EOF > ~/.config/nix/nix.conf
experimental-features = nix-command flakes
EOF
- Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Download the repository
- Restore the Nix configuration
nix build .#darwinConfigurations.<hostname>.system
./result/sw/bin/darwin-rebuild switch --flake .
- To install a new package, add it to the
home-manager/default.nix
orhome-manager/applications/
file and runnix build .#darwinConfigurations.jumac.system
again. - To update all packages, run
nix flake update && nix build .#darwinConfigurations.jumac.system
. - To edit any configuration file, modify the corresponding file in the
home-manager/
ordarwin/
directory and rundarwin-rebuild switch --flake ~/nixconfig
.
nix-channel --update
nix --extra-experimental-features "nix-command flakes" flake update
nix --extra-experimental-features "nix-command flakes" build .#darwinConfigurations.jumac.system --impure
darwin-rebuild switch --flake ~/nixconfig --show-trace --impure
If you have any suggestions, improvements or bugfixes, feel free to open a pull request. I appreciate any help and feedback!