This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a cross-platform NixOS configuration repository supporting both macOS (via nix-darwin) and NixOS systems. It uses Nix Flakes exclusively and follows a modular architecture.
- Display Server: Wayland (not X11)
- Desktop Environment: KDE Plasma 6
- Window Manager: KWin (Wayland)
Important: When working with GUI applications, ensure Wayland compatibility. For example:
- Use
rofi-waylandinstead ofrofi - Check for Wayland-specific versions of applications
- Some X11-only applications may need XWayland compatibility layer
NixOS (x86_64-linux):
# Build and switch to new configuration
nix run .#build-switch
# Build, switch, and restart Emacs daemon (use after Emacs config changes)
nix run .#build-switch-emacs
# Install fresh system (without secrets)
nix run .#install
# Install fresh system (with secrets)
nix run .#install-with-secrets
# Clean up old generations and boot files (frees disk space)
nix run .#cleanImportant:
- After making changes to Nix configuration files, run
nix run .#build-switch - After making changes to Emacs configuration (
modules/shared/config/emacs/config.org), runnix run .#build-switch-emacs
macOS (x86_64-darwin):
# Test build without switching
nix run .#build
# Build and switch to new configuration
nix run .#build-switch
# Rollback to previous generation
nix run .#rollback
# Clean up old generations (frees disk space)
nix run .#clean# Update flake inputs
nix flake update
# Check flake
nix flake check
# Format Nix files
nixpkgs-fmt .
# Lint Nix code (runs in CI)
statix checkhosts/- Host-specific configurations (darwin/default.nix for macOS, nixos/default.nix for NixOS)modules/- Modular configuration components:shared/- Cross-platform configurations (packages, home-manager, fonts)nixos/- Linux-specific packages and configurationsdarwin/- macOS-specific packages and Homebrew integration
overlays/- Auto-loading Nix overlays (any .nix file here runs automatically)apps/- Platform-specific build and deployment scriptstemplates/- Starter templates for new users
-
Module Inheritance: Platform-specific modules extend shared configurations
# Example from modules/nixos/packages.nix packages = with pkgs; [ # Shared packages are inherited ] ++ sharedPackages;
-
Auto-loading Overlays: Drop any .nix file in
overlays/and it loads automatically via:# modules/shared/default.nix nixpkgs.overlays = import ../../overlays {inherit lib pkgs inputs outputs;};
-
Secrets Management: Uses
agenixfor encrypted secrets- Secrets defined in
hosts/{platform}/secrets/secrets.nix - Age keys in
hosts/{platform}/secrets/keys/
- Secrets defined in
-
Home Manager Integration: User-level configurations in
modules/shared/home-manager.nix
flake.nix- Main entry point defining inputs and system configurationshosts/nixos/default.nix- NixOS system configuration (hostname: "felix")hosts/darwin/default.nix- macOS system configurationmodules/shared/packages.nix- Cross-platform package definitionsmodules/shared/home-manager.nix- Shell, editor, and tool configurations
IMPORTANT: When creating ANY new file in this repository (overlays, modules, configurations, etc.), you MUST add it to git with git add before running nix run .#build-switch. Nix flakes only see files tracked by git, so untracked files will cause build failures. This applies to ALL files, not just overlays.
- Cross-platform packages: Add to
modules/shared/packages.nix - NixOS-only packages: Add to
modules/nixos/packages.nix - macOS-only packages: Add to
modules/darwin/packages.nix - Homebrew casks (macOS): Add to
modules/darwin/casks.nix
Create a new .nix file in overlays/ directory. It will be automatically loaded.
Edit modules/shared/home-manager.nix for:
- Zsh configuration and aliases
- Git settings
- Terminal emulator (Alacritty) configuration
- Tmux settings
- SSH configuration
The Emacs configuration is a literate Org-mode file at modules/shared/config/emacs/config.org. This file:
- Contains all Emacs configuration in Org-mode code blocks
- Is automatically tangled to
config.elwhen building - Includes comprehensive documentation alongside the configuration
- Supports adding new packages and customizations in the appropriate sections
Important: When making changes to Emacs configuration:
- Edit
modules/shared/config/emacs/config.org - If adding a new package, also add it to
modules/shared/emacs.nix - Run
nix run .#build-switchto rebuild the configuration - Restart the Emacs daemon with:
emacsclient -e "(kill-emacs)" - The daemon will automatically restart when you next use Emacs
- Update cheatsheets: Check if the relevant cheatsheets in
/home/dustin/cheatsheets/need to be updated with new keybindings or features (especiallyemacs.md)
- NixOS boot/kernel:
hosts/nixos/default.nix - macOS system settings:
hosts/darwin/default.nix - Disk partitioning (NixOS):
hosts/nixos/disk-config.nix
Always test configuration changes before applying:
- Run
nix flake checkto validate the flake - Use platform-specific build command to test
- Review changes before switching
GitHub Actions automatically:
- Tests starter template builds
- Runs statix linting on Nix code
- Updates flake.lock weekly
- Manages dependencies via Dependabot