# CLAUDE.md

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

## Build Commands

```bash
# Rebuild and switch to new configuration
sudo nixos-rebuild switch --flake ~/.config/nixos/#hakase

# Manage SOPS secrets
nix-shell -p sops --run "sops secrets/secrets.yaml"
nix-shell -p sops --run "sops updatekeys secrets/secrets.yaml"
```

## Architecture Overview

This is a modular, flake-based NixOS configuration for a single host (`hakase`).

### Key Entry Points

- `flake.nix` - Declares inputs and creates NixOS configuration
- `config.nix` - Central configuration values (username, hostname, paths, theme settings, bookmarks)
- `hosts/hakase/configuration.nix` - Host-level entry point that imports system modules

### Module Organization

**Two-tier module system:**
- `modules/system/` - NixOS system-level modules (boot, kernel, services, hardware)
- `modules/home/` - Home Manager user-level modules (imported via `home/hakase.nix`)

**Application configs:** Each application has its own directory in `apps/` with a `default.nix` and optional sub-modules (e.g., `apps/hyprland/hypr/*.nix` for Hyprland settings).

### Configuration Flow

```
flake.nix
  └─ nixosConfigurations.hakase
       ├─ hosts/hakase/configuration.nix
       │   └─ modules/system/default.nix (imports all system modules)
       └─ home-manager
           └─ home/hakase.nix
               └─ modules/home/* → apps/*
```

### Module Pattern

Modules receive these parameters:
```nix
{ pkgs, config, myConfig, inputs, ... }:
```

Access configuration values via `myConfig`:
```nix
myConfig.nixos.username    # "hakase"
myConfig.nixos.hostname    # "hakase"
myConfig.terminal.default  # Terminal emulator
myConfig.hyprland.monitors # Monitor configuration
```

### Secrets Management

Uses SOPS for encrypted secrets. Keys stored at `~/.config/sops/age/keys.txt`.

Access secrets in modules:
```nix
config.sops.secrets.secret_name.path
```

## Key Technologies

- **Hyprland** with UWSM (systemd session management)
- **Stylix** for system-wide theming from wallpaper colors
- **Home Manager** for user environment
- **nixovim** flake for Neovim configuration

## Git Commit Convention

Use conventional commits: `feat(scope):`, `fix(scope):`, `refactor:`, `add:`, `remove:`, `cleanup:`
