agentleFS
dustinlyonsdustinlyons/nixos-config/CLAUDE.md

nixos-config

CLAUDE.md3.6k starsChanged 46 days agoBSD-3-ClauseView on GitHub

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. Important: When working with GUI applications, ensure Wayland compatibility. For example: - Use rofi-wayland instead of rofi - Check for Wayland-specific versions of applications - Some X11-only applications may need XWayland compatibility layer **NixOS (x86_64-linux):** Important: - After making changes to Nix configuration files, run nix run .#build-switch - After making changes to Emacs configuration…

We split this CLAUDE.md into the rules it gives an agent

16 rules. About 0 are common, 4 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use rofi-wayland instead of rofi

    line 16
  2. Distinctive:

    Check for Wayland-specific versions of applications

    line 17
  3. Very specific:

    After making changes to Nix configuration files, run nix run .#build-switch

    line 43
  4. Very specific:

    After making changes to Emacs configuration (modules/shared/config/emacs/config.org), run nix run .#build-switch-emacs

    line 44
  5. Very specific:

    Cross-platform packages: Add to modules/shared/packages.nix

    line 125
  6. Very specific:

    NixOS-only packages: Add to modules/nixos/packages.nix

    line 126
  7. Very specific:

    macOS-only packages: Add to modules/darwin/packages.nix

    line 127
  8. Very specific:

    Homebrew casks (macOS): Add to modules/darwin/casks.nix

    line 128
  9. Very specific:

    Create a new .nix file in overlays/ directory.

    line 131
  10. Distinctive:

    Important: When making changes to Emacs configuration:

    line 148
  11. Very specific:

    If adding a new package, also add it to modules/shared/emacs.nix

    line 150
  12. Very specific:

    Run nix run .#build-switch to rebuild the configuration

    line 151
  13. Very specific:

    Update cheatsheets: Check if the relevant cheatsheets in /home/dustin/cheatsheets/ need to be updated with new keybindings or features …

    line 154
  14. Distinctive:

    Always test configuration changes before applying:

    line 163
  15. Very specific:

    Run nix flake check to validate the flake

    line 164
  16. Distinctive:

    Use platform-specific build command to test

    line 165

≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Repository Overview

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.

System Environment

  • 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-wayland instead of rofi
  • Check for Wayland-specific versions of applications
  • Some X11-only applications may need XWayland compatibility layer

Key Commands

Building and Switching Configurations

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 .#clean

Important:

  • After making changes to Nix configuration files, run nix run .#build-switch
  • After making changes to Emacs configuration (modules/shared/config/emacs/config.org), run nix 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

Development Commands

# Update flake inputs
nix flake update

# Check flake
nix flake check

# Format Nix files
nixpkgs-fmt .

# Lint Nix code (runs in CI)
statix check

Architecture

Directory Structure

  • hosts/ - 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 configurations
    • darwin/ - macOS-specific packages and Homebrew integration
  • overlays/ - Auto-loading Nix overlays (any .nix file here runs automatically)
  • apps/ - Platform-specific build and deployment scripts
  • templates/ - Starter templates for new users

Key Patterns

  1. Module Inheritance: Platform-specific modules extend shared configurations
    # Example from modules/nixos/packages.nix
    packages = with pkgs; [
      # Shared packages are inherited
    ] ++ sharedPackages;
  2. 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;};
  3. Secrets Management: Uses agenix for encrypted secrets
    • Secrets defined in hosts/{platform}/secrets/secrets.nix
    • Age keys in hosts/{platform}/secrets/keys/
  4. Home Manager Integration: User-level configurations in modules/shared/home-manager.nix

Important Configuration Files

  • flake.nix - Main entry point defining inputs and system configurations
  • hosts/nixos/default.nix - NixOS system configuration (hostname: "felix")
  • hosts/darwin/default.nix - macOS system configuration
  • modules/shared/packages.nix - Cross-platform package definitions
  • modules/shared/home-manager.nix - Shell, editor, and tool configurations

Working with This Repository

CRITICAL: Git Tracking Requirement

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.

Adding Packages

  1. Cross-platform packages: Add to modules/shared/packages.nix
  2. NixOS-only packages: Add to modules/nixos/packages.nix
  3. macOS-only packages: Add to modules/darwin/packages.nix
  4. Homebrew casks (macOS): Add to modules/darwin/casks.nix

Creating Overlays

Create a new .nix file in overlays/ directory. It will be automatically loaded.

Modifying Shell Configuration

Edit modules/shared/home-manager.nix for:

  • Zsh configuration and aliases
  • Git settings
  • Terminal emulator (Alacritty) configuration
  • Tmux settings
  • SSH configuration

Editing Emacs 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.el when building
  • Includes comprehensive documentation alongside the configuration
  • Supports adding new packages and customizations in the appropriate sections

Important: When making changes to Emacs configuration:

  1. Edit modules/shared/config/emacs/config.org
  2. If adding a new package, also add it to modules/shared/emacs.nix
  3. Run nix run .#build-switch to rebuild the configuration
  4. Restart the Emacs daemon with: emacsclient -e "(kill-emacs)"
  5. The daemon will automatically restart when you next use Emacs
  6. Update cheatsheets: Check if the relevant cheatsheets in /home/dustin/cheatsheets/ need to be updated with new keybindings or features (especially emacs.md)

System-specific Changes

  • NixOS boot/kernel: hosts/nixos/default.nix
  • macOS system settings: hosts/darwin/default.nix
  • Disk partitioning (NixOS): hosts/nixos/disk-config.nix

Testing Changes

Always test configuration changes before applying:

  1. Run nix flake check to validate the flake
  2. Use platform-specific build command to test
  3. Review changes before switching

CI/CD

GitHub Actions automatically:

  • Tests starter template builds
  • Runs statix linting on Nix code
  • Updates flake.lock weekly
  • Manages dependencies via Dependabot

Download now (ZIP)

Trending

Quiet since April.about the whole repository

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 2 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the dustinlyons/nixos-config repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about dustinlyons/nixos-config

The biggest 5 of 17 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 17

Talked about on GitHub, Hacker News and Bluesky (17 times).

On GitHub · 14

9 more on GitHub

On Bluesky · 1

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.