# 1. Copy hardware configuration from NixOS installation
cp /etc/nixos/hardware-configuration.nix hosts/${HOST}/hardware-configuration.nix
# 2. Create directories for user data
for dir in ~/Music ~/Documents ~/Pictures/wallpapers/others; do
mkdir -p "$dir"
done
# 3. Copy wallpapers
cp -r wallpapers/otherWallpaper/gruvbox/* ~/Pictures/wallpapers/others/ && \
cp -r wallpapers/otherWallpaper/nixos/* ~/Pictures/wallpapers/others/ && \
ln -sf $PWD/wallpapers/wallpaper.png ~/Pictures/wallpapers/wallpaper
sudo nixos-rebuild switch --flake .#${HOST}- flake.nix base of the configuration
- hosts 🌳 per-host configurations that contain machine specific configurations
- modules 🍱 modularized configurations
- wallpapers 🌄 wallpapers collection
The Mac is managed declaratively with nix-darwin and home-manager. GUI apps are installed as Homebrew casks driven by nix-homebrew.
# 1. Install Nix (Determinate installer — flakes enabled by default).
# Open a NEW terminal afterwards so the daemon is on PATH.
curl -fsSL https://install.determinate.systems/nix | sh -s -- install
# 2. Bootstrap nix-darwin (darwin-rebuild doesn't exist yet, so run it via nix).
sudo nix run github:nix-darwin/nix-darwin/master#darwin-rebuild -- \
switch --flake ~/git/nix-config#Andres-MacBook-Pro
# If it complains that /etc/zshrc (or /etc/bashrc) already exists:
# sudo mv /etc/zshrc /etc/zshrc.before-nix-darwin
# then re-run the command. The first run also installs Homebrew + casks.
# 3. Apply changes on every subsequent edit.
sudo darwin-rebuild switch --flake ~/git/nix-config#Andres-MacBook-Pro
# 4. Set fish as the login shell (one-time). The rebuild registers fish in
# /etc/shells via `environment.shells`, so chsh will accept it.
chsh -s /run/current-system/sw/bin/fish
# Open a new terminal afterwards. fish is configured in modules/home/common/shell.nix.Note: the Determinate installer ships Determinate Nix, which manages the Nix daemon itself, so the darwin config sets
nix.enable = false(see modules/darwin/nix.nix). Add GUI apps by editing thecaskslist in modules/darwin/homebrew.nix.
Based on anddani/nix-home