This is a personal dotfiles repository using Nix Flakes, Home Manager, and nix-darwin to manage system configurations across NixOS (workstation) and macOS (macbook) systems. The configuration is highly modular and organized by function.
flake.nix: Main entry point defining nixosConfigurations and darwinConfigurationshosts/: NixOS host configurations (workstation)darwin/: macOS-specific configurations (macbook)modules/: Reusable configuration modulesprograms/: Individual program configurations (git, neovim, vscode, etc.)services/: System services (gpg-agent, ollama, pueue, etc.)hardware/: Hardware-specific configurations (bluetooth, opengl)
- Each program module is self-contained in
modules/programs/ - Complex programs (neovim, vscode, wezterm) have their own directories
- Configuration uses Home Manager for user-level settings
- System-wide settings are in
hosts/configuration.nix(NixOS) ordarwin/configuration.nix(macOS)
NixOS (workstation):
# Rebuild and switch system configuration
sudo nixos-rebuild switch --flake .#workstation
# Test configuration without switching
sudo nixos-rebuild test --flake .#workstation
# Build configuration without activating
sudo nixos-rebuild build --flake .#workstationmacOS (macbook):
# Rebuild and switch Darwin configuration
darwin-rebuild switch --flake .#macbook
# Build without switching
darwin-rebuild build --flake .#macbook
# Show what would change
darwin-rebuild check --flake .#macbook# Update all flake inputs
nix flake update
# Update specific input
nix flake update nixpkgs
# Check flake metadata
nix flake metadata
# Show flake outputs
nix flake show# Format Nix files
nixpkgs-fmt .
# Check for evaluation errors
nix flake check
# Garbage collection
nix-collect-garbage -dWhen modifying program configurations:
- Program modules are in
modules/programs/[program].nix - Each module typically exports a Home Manager configuration
- Modules are imported in
modules/programs/default.nix - Host-specific overrides go in
hosts/[hostname]/home.nixordarwin/home.nix
- User is always
"shady" - Systems:
"x86_64-linux"(workstation),"aarch64-darwin"(macbook) - Overlays are defined in host default.nix files
To add a new program configuration:
- Create
modules/programs/[program].nix - Add import to
modules/programs/default.nix - Structure should follow existing patterns (see git.nix, zsh.nix for examples)
- Use Home Manager's program options when available
Always test configuration changes before committing:
- Run
nix flake checkto validate - Build configuration with
nixos-rebuild buildordarwin-rebuild build - Test in VM if making significant system changes
- Switch only after successful build