Nix logo

NixConfig

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

Requirements

Installation

  1. 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
  1. Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Download the repository
  2. Restore the Nix configuration
nix build .#darwinConfigurations.<hostname>.system
./result/sw/bin/darwin-rebuild switch --flake .

Usage

  • To install a new package, add it to the home-manager/default.nix or home-manager/applications/ file and run nix 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/ or darwin/ directory and run darwin-rebuild switch --flake ~/nixconfig.

Update

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

Contributing

If you have any suggestions, improvements or bugfixes, feel free to open a pull request. I appreciate any help and feedback!