Nix Configuration

June 20, 2025 ยท View on GitHub

Nix Configuration

Setup

NixOS

  • Boot Live disk.
  • Format disk.
    • Eventually tweak hosts/<hostname>/configuration.nix.
  • Run nixos-rebuild switch --flake "github:oliverwiegers/nix-config#<host>.
  • Reboot host.
  • Run nix run nixpkgs#home-manager.out -- switch --flake .#<username>@<host>

MacOS

# Install Nix
sh <(curl -L https://nixos.org/nix/install) --daemon

# Create project home and clone repository.
mkdir ~/Documents/projects && cd ~/Documents/projects

nix run \
  --extra-experimental-features 'nix-command flakes' nixpkgs#git.out \
  -- clone git@github.com:oliverwiegers/nix-config

# Setup nix-darwin.
nix run \
  --extra-experimental-features 'nix-command flakes' nix-darwin \
  -- switch --flake .#host

# Setup home-manager.
nix run \
  --extra-experimental-features 'nix-command flakes' nixpkgs#home-manager.out \
  -- switch --flake .#oliverwiegers@enigma

Update System

cd <repo-folder>
nix flake update
sudo nixos-rebuild switch --flake .#<hostname>
home-manager switch --flake .#<hostname>@<user>

FAQ

  • Q: Why can't flake find existing file? A: Because it isn't added to git. See here.