|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build commands |
| 6 | + |
| 7 | +```bash |
| 8 | +# Build and switch to the macOS nix-darwin configuration |
| 9 | +sudo darwin-rebuild switch --flake . |
| 10 | + |
| 11 | +# Build without switching (for testing) |
| 12 | +sudo darwin-rebuild --flake . |
| 13 | + |
| 14 | +# Update all flake inputs |
| 15 | +nix flake update |
| 16 | + |
| 17 | +# Update a specific input |
| 18 | +nix flake update nixpkgs-unstable |
| 19 | +``` |
| 20 | + |
| 21 | +## Architecture |
| 22 | + |
| 23 | +This is a Nix flake that manages system configuration for macOS (via nix-darwin and home-manager) and Linux (via home-manager). |
| 24 | + |
| 25 | +### Key Structure |
| 26 | + |
| 27 | +- `flake.nix` — Main entry point. Defines inputs (nixpkgs-unstable, nix-darwin, home-manager, nixCats, nix-homebrew, agenix, etc.) and outputs (darwinConfigurations, nixosConfigurations, homeConfigurations, apps, devShells, checks). |
| 28 | +- `hosts/` — Per-machine configs. Each host is a `default.nix` that selects modules/options: |
| 29 | + - `macbook-gipedo` — Work Mac (aarch64-darwin). Enables gui, work, ai, nvim, languages (python/go/ruby/web/devops). |
| 30 | + - `macbook-christoph` — Personal Mac (aarch64-darwin). Enables gui, ai, nvim, languages (python/go/web/devops). |
| 31 | + - `tuxedo` — Linux desktop (x86_64-linux/NixOS). Enables gui, nvim, Hyprland WM. |
| 32 | +- `modules/` — All configuration logic, organized in three namespaces: |
| 33 | + - `modules/common/` — Cross-platform: shell (zsh, tmux, git, fzf, zoxide, direnv), applications (alacritty, brave, etc.), programming languages, nvim config. |
| 34 | + - `modules/darwin/` — macOS-specific: homebrew casks, system defaults, TouchID sudo, keyboard layout, colima, ollama, trampoline fix. |
| 35 | + - `modules/nixos/` — Linux-specific: Hyprland WM + waybar, hardware (audio, boot, wifi), fonts, SDDM. |
| 36 | +- `overlays/` — Nix overlays (see Overlays section below). |
| 37 | +- `apps/` — Runnable via `nix run .#<name>`: `nvim` (standalone neovim), `ollama` (pull models), `installer` (NixOS disk installer, Linux only). |
| 38 | +- `secrets/` — Age-encrypted secrets via agenix (github, claude, grafana, context7 tokens). |
| 39 | +- `templates/` — Flake templates: `basic` and `python`. |
| 40 | +- `misc/` — Hashed password for Linux user. |
| 41 | + |
| 42 | +### Notable Options & Flags |
| 43 | + |
| 44 | +- `ai.enable` — Gates copilot, codecompanion, claude-code, MCP servers, copilot-usage tmux widget. |
| 45 | +- `work.enable` — Toggles work vs personal Homebrew casks (Figma/Google Drive vs Tunnelblick/Cloudflare WARP). |
| 46 | +- `gui.enable` — Enables GUI applications. |
| 47 | +- Theme: **Catppuccin Mocha** used across nvim, tmux, and alacritty. |
| 48 | + |
| 49 | +### Nvim |
| 50 | + |
| 51 | +Neovim config lives in `modules/common/nvim/`. Packaged via **nixCats** (Nix-native plugin management) with **lazy.nvim** for load ordering. |
| 52 | + |
| 53 | +- `default.nix` — nixCats package definition with categories (general, debug, go, python, web, java, devops, ai, etc.) |
| 54 | +- `lua/chrishrb/config/` — Base options, keymaps, commands, icons |
| 55 | +- `lua/chrishrb/plugins/` — lazy.nvim plugin specs + per-plugin config in `plugins/config/` |
| 56 | +- `lua/chrishrb/lsp/` — LSP server configs (gopls, lua_ls, pylsp, ts_ls, nil/nixd, yamlls, etc.). Mason is disabled; all servers come from Nix. |
| 57 | +- `lua/chrishrb/dap/` — Debug adapter configs (go, python, php) |
| 58 | +- `lua/chrishrb/autocommands/` — Filetype/event autocommands |
| 59 | +- `prompts/` — AI prompt templates for codecompanion (commit, refactor, explain, tests, etc.) |
| 60 | +- `overlays/` — Nvim-specific overlays (vim-plugins from flake inputs, mcphub, treesitter) |
| 61 | + |
| 62 | +Key plugins: telescope, nvim-tree, treesitter, nvim-cmp, nvim-lspconfig, trouble, fugitive, gitsigns, nvim-dap, codecompanion (AI), copilot, catppuccin theme, lualine, tmux-navigation. |
| 63 | + |
| 64 | +## Overlays |
| 65 | + |
| 66 | +Defined in `overlays/`, auto-composed via `default.nix`: |
| 67 | + |
| 68 | +## Linting & CI |
| 69 | + |
| 70 | +Pre-commit hooks enforce **nixfmt**, **stylua**, and **shellcheck**. The dev shell (`nix develop`) provides these plus shfmt and agenix. Run the formatter with `nix fmt`. |
| 71 | + |
0 commit comments