aboutsummaryrefslogtreecommitdiff
path: root/CLAUDE.md
blob: d7cd295646b9a9f3c3f75ac09e01d4e59aba772a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# CLAUDE.md

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

## Project Overview

NixOS flake configuration for multiple machines (kronos laptop, herra desktop) using NixOS 25.11 and Home Manager 25.11. Features a layered architecture with swappable desktop rices.

## Common Commands

```bash
# Apply configuration (full rebuild and activation)
sudo nixos-rebuild switch

# Test configuration without making it the default boot option
sudo nixos-rebuild test

# Validate flake syntax and check for errors
nix flake check

# Preview what changes would be made
sudo nixos-rebuild dry-run

# Update flake inputs to latest versions
nix flake update

# Update specific input (e.g., nixpkgs)
nix flake lock --update-input nixpkgs

# Build for specific host
sudo nixos-rebuild switch --flake .#kronos
sudo nixos-rebuild switch --flake .#herra
```

## Architecture

```
flake.nix                          # Entry point
  ↓
hosts/{kronos,herra}/              # Per-machine (hostname + hardware)
  ↓
system/                            # System-wide config
  ├─ boot, audio, bluetooth, networking, graphics
  ├─ packages, programs, services, users, nix
  ├─ desktop.nix                   # X11 + i3wm
  └─ stylix.nix                    # Theming
  ↓
home/mun/                          # User config
  ├─ programs/                     # git, ssh, zsh
  └─ (imports active rice)
  ↓
home/rices/{nord-blue,original}/   # Desktop themes
```

## Key Files

- `flake.nix` - Defines inputs (nixpkgs, nixpkgs-unstable, home-manager, stylix, fenix, crane, nixowos) and outputs
- `hosts/kronos/configuration.nix` - Laptop-specific config (minimal: just hostname)
- `hosts/herra/configuration.nix` - Desktop config (dual-boot with Windows 11, uses GRUB OS prober)
- `system/default.nix` - System module orchestrator
- `system/packages.nix` - System-wide packages
- `home/mun/default.nix` - User orchestrator (imports active rice, user packages, programs)
- `home/rices/nord-blue/variables.nix` - Active rice color definitions
- `home/rices/nord-blue/default.nix` - Active rice module orchestrator

## Adding Configurations

**New system package:** Add to `system/packages.nix` under `environment.systemPackages`

**New user package:** Add to `home/mun/default.nix` under `home.packages` (supports fenix Rust toolchain, TeX Live combinations, RetroArch cores)

**New system module:** Create in `system/`, add to `system/default.nix` imports

**New user program:** Create in `home/mun/programs/`, add to `home/mun/default.nix` imports

**New rice module:** Create in active rice directory (`home/rices/nord-blue/`), add to its `default.nix` imports

**New rice:** Create `home/rices/my-rice/` with `default.nix` (imports modules) and `variables.nix` (colors, wallpaper)

## Switching Rices

Edit `home/mun/default.nix` to change the rice import:
```nix
imports = [
  ./programs/zsh.nix
  ./programs/ssh.nix
  ./programs/git.nix
  ../rices/nord-blue    # Current: alacritty, i3, nvim, helix, picom, fastfetch
  # ../rices/original  # Alternative: kitty, i3, polybar, rofi, dunst, neovim, nnn, picom
];
```

Then: `sudo nixos-rebuild switch`

## Important Architecture Details

**Overlays:** Flake provides `pkgs.unstable.*` for accessing bleeding-edge packages from nixpkgs-unstable while staying on stable 25.11

**NixOwOs Integration:** Enabled in `home/mun/default.nix` for NixOS branding/theming (os-release customization, overlays)

**Machine Separation:** Host configs are intentionally minimal (hostname + hardware). All shared system config lives in `system/`, all shared user config in `home/mun/`

**Rice Philosophy:** Rices are purely home-manager level. Desktop environment (X11 + i3wm base) is defined in `system/desktop.nix`, rices only configure appearance/theming

**Stylix:** System-level theming framework imported at flake level, configured in `system/stylix.nix`