Skip to content

Commit 78e0943

Browse files
committed
feat: add sketchybar status bar with AeroSpace integration
- Configure sketchybar with native macOS appearance (transparent with blur) - Add Apple menu with popup (System Settings, Activity Monitor, Lock Screen) - Integrate 8 AeroSpace workspaces with dynamic app icons - Add right-side items: calendar, volume, and battery (icon-only) - Use consistent bash array syntax across all items and plugins - Configure fonts to match native macOS (SF Pro Text Medium) - Set 2px top margin and display on main monitor only - Add sketchybar-app-font installation via home activation - Update AeroSpace: 8 workspaces, all on main display, top gap 28px - Remove deprecated front_app item
1 parent b4a1540 commit 78e0943

File tree

18 files changed

+845
-97
lines changed

18 files changed

+845
-97
lines changed

CLAUDE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
55
## Core Commands
66

77
### macOS (nix-darwin)
8+
89
```bash
910
# Apply system configuration (auto-detects hostname)
1011
nixswitch
@@ -17,6 +18,7 @@ git pull && nixswitch
1718
```
1819

1920
### Linux (Home Manager)
21+
2022
```bash
2123
# Apply generic Linux configuration (minimal - for Docker/containers)
2224
hmswitch
@@ -40,12 +42,14 @@ git pull && hmswitch
4042
This is a **cross-platform Nix configuration** managing both macOS hosts and Linux development environments. The architecture follows a modular, hybrid approach:
4143

4244
### Key Design Principles
45+
4346
- **Host-VM separation**: Clean macOS host with isolated Linux development environment
4447
- **ARM64-first**: Optimized for Apple Silicon and ARM cloud instances
4548
- **Shared configuration**: Common settings abstracted into reusable modules
4649
- **Hybrid package management**: Nix for development tools, Homebrew for macOS GUI apps
4750

4851
### Directory Structure
52+
4953
```
5054
├── flake.nix # Main orchestrator - defines all configurations
5155
├── common/ # Shared configuration across platforms
@@ -78,6 +82,7 @@ This is a **cross-platform Nix configuration** managing both macOS hosts and Lin
7882
```
7983

8084
### Configuration Flow
85+
8186
1. **flake.nix** - Entry point defining `darwinConfigurations` and `homeConfigurations`
8287
2. **common/home-manager-base.nix** - Imports shared modules (home-packages, claude-code, programs, scripts)
8388
3. **common/programs/default.nix** - Centralized program configurations (direnv, gh, zsh base)
@@ -86,7 +91,9 @@ This is a **cross-platform Nix configuration** managing both macOS hosts and Lin
8691
6. **packages.nix** - Centralized package definitions organized by category
8792

8893
### Recent Architectural Changes (2025)
94+
8995
**Major refactoring eliminated 479+ lines of duplicate configuration:**
96+
9097
- Created `common/home-manager-base.nix` to centralize Home Manager settings
9198
- Created `common/programs/default.nix` for shared program configurations
9299
- **Unified git configuration** in `common/git/` with platform detection for SSH signing
@@ -100,6 +107,7 @@ This is a **cross-platform Nix configuration** managing both macOS hosts and Lin
100107
## Development Workflow
101108

102109
### Making Configuration Changes
110+
103111
1. Edit configuration files in appropriate directory:
104112
- `common/` for shared changes
105113
- `common/profiles/` for optional profiles (Wayland, etc.)
@@ -109,6 +117,7 @@ This is a **cross-platform Nix configuration** managing both macOS hosts and Lin
109117
3. Commit changes: `git commit -am "description"`
110118

111119
### Package Management
120+
112121
- **Add everywhere**: Edit `common/packages.nix`:
113122
- `corePackages` - Essential CLI tools (oh-my-posh, eza, zoxide, bat, etc.)
114123
- `devPackages` - Development tools (gh, lazygit, docker-compose, htop, curl, wget, etc.)
@@ -118,6 +127,7 @@ This is a **cross-platform Nix configuration** managing both macOS hosts and Lin
118127
- **Profile-specific packages**: Edit `common/profiles/hyprland.nix` for Linux desktop apps
119128

120129
**IMPORTANT**: Platform-specific packages must be separated:
130+
121131
- macOS-only packages (like `reattach-to-user-namespace`) go in `darwinPackages` and are imported via `systems/aarch64-darwin/home.nix`
122132
- Profile-specific packages (like Hyprland/Wayland tools) go in `common/profiles/hyprland.nix` and are opt-in via `extraModules`
123133
- Never put macOS-only packages in shared `corePackages` or `devPackages` or they'll break Linux builds
@@ -128,9 +138,11 @@ This is a **cross-platform Nix configuration** managing both macOS hosts and Lin
128138
**Profile Architecture**: Optional configurations that extend the base system without polluting minimal environments.
129139

130140
**Available Profiles**:
141+
131142
- `common/profiles/hyprland.nix` - Hyprland desktop environment (full-featured, Linux only)
132143

133144
**hyprland.nix includes**:
145+
134146
- **Hyprland** - Modern Wayland compositor with animations
135147
- **Dev tools** - mise, lazydocker, btop, Docker, databases
136148
- **Desktop apps** - Obsidian, Signal, Chromium, LocalSend
@@ -156,6 +168,7 @@ desktop = mkHomeManagerConfig {
156168

157169
**Customizing hyprland.nix**:
158170
Edit the profile and comment out packages you don't want:
171+
159172
```nix
160173
# Media (comment out what you don't want)
161174
mpv
@@ -166,13 +179,16 @@ spotify
166179
```
167180

168181
**Benefits**:
182+
169183
- Default stays minimal (Docker/containers unaffected)
170184
- Explicit opt-in for additional functionality
171185
- Easy to compose multiple profiles
172186
- Clear separation of concerns
173187

174188
### Adding New Hosts
189+
175190
Create new configuration in `flake.nix`:
191+
176192
```nix
177193
# For macOS
178194
"hostname" = mkDarwinSystem {
@@ -189,22 +205,27 @@ Create new configuration in `flake.nix`:
189205
## Special Features
190206

191207
### Claude Code Integration
208+
192209
Located in `common/claude-code/`, this provides:
210+
193211
- **Custom commands**: Linear integration, conventional commits, breakdown command
194212
- **Sophisticated hooks**: Automated linting and quality checks
195213
- **Modular structure**: Combines local and remote commands via symlinkJoin
196214

197215
### Shell Configuration
216+
198217
- **History Search**: fzf with Catppuccin Mocha theme (`source <(fzf --zsh)`)
199218
- **Directory Navigation**: zoxide aliased to `cd` for smart directory jumping
200219
- **Prompt**: Oh My Posh with custom theme
201220
- **Completions**: Carapace for 300+ CLI tools
202221

203222
### Version Management
223+
204224
- **Terraform**: Managed as regular nixpkgs in Linux configurations
205225
- **Node.js**: Uses nodePackages.pnpm from nixpkgs
206226

207227
### Multi-Environment Support
228+
208229
- **Generic Linux**: Flexible Home Manager configuration for any Linux environment (minimal by default)
209230
- **Profile-based configs**: Optional modules for desktop environments (Wayland/Sway), server tools, etc.
210231
- **Development Shell**: Available via `nix develop` for working on this configuration
@@ -213,12 +234,14 @@ Located in `common/claude-code/`, this provides:
213234
## Platform-Specific Notes
214235

215236
### macOS (nix-darwin)
237+
216238
- Manages system preferences via `systems/aarch64-darwin/defaults.nix`
217239
- Dock configuration in `systems/aarch64-darwin/dock.nix`
218240
- Homebrew integration for GUI applications
219241
- SSH configuration for VM connectivity
220242

221243
### Linux (home-manager)
244+
222245
- **Minimal by default** - base configuration for Docker/containers
223246
- **Profile system** - opt-in desktop environments (Wayland/Sway) or additional tools
224247
- Docker integration (docker-compose package)
@@ -227,10 +250,12 @@ Located in `common/claude-code/`, this provides:
227250
- Auto-optimise-store enabled (better suited for Linux than macOS)
228251

229252
**Available Configurations**:
253+
230254
- `#minimal-x86` / `#minimal-arm` - Minimal (Docker/containers)
231255
- `#desktop-x86` / `#desktop-arm` - Full desktop environment (Hyprland, dev tools, GUI apps)
232256

233257
## Security Considerations
258+
234259
- SSH keys managed through 1Password integration
235260
- Tailscale for secure cloud connectivity
236261
- Proper credential management for AWS profiles
@@ -255,6 +280,7 @@ docker-compose run --rm nix-dev
255280
```
256281

257282
**Docker Setup Details:**
283+
258284
- Ubuntu 24.04 base with pinned SHA256
259285
- Pinned package versions (curl, git, sudo, xz-utils, ca-certificates, zsh)
260286
- Pinned Nix version: 2.24.10
@@ -265,6 +291,7 @@ docker-compose run --rm nix-dev
265291
## Configuration Development Commands
266292

267293
### Nix Development Tools (via `nix develop`)
294+
268295
```bash
269296
# Enter development shell with Nix tools
270297
nix develop
@@ -277,6 +304,7 @@ nil # Nix LSP for editor integration
277304
```
278305

279306
### Configuration Validation
307+
280308
```bash
281309
# Check flake syntax and evaluation
282310
nix flake check
@@ -288,6 +316,7 @@ nix eval .#homeConfigurations.ubuntu.activationPackage
288316
```
289317

290318
### Troubleshooting Commands
319+
291320
```bash
292321
# Debug build issues
293322
nixswitch --show-trace
@@ -305,6 +334,7 @@ home-manager generations # Linux - shows available generations
305334
## Advanced Architecture Details
306335

307336
### Module Resolution System
337+
308338
The configuration uses a layered import system that eliminates duplication:
309339

310340
1. **flake.nix**: Orchestrates everything using `mkDarwinSystem` and `mkHomeManagerConfig` functions
@@ -323,6 +353,7 @@ The configuration uses a layered import system that eliminates duplication:
323353
- **Linux**: homeDirectory + nix settings + platform aliases (hmswitch, hm-user) + worktree manager
324354

325355
### Cross-Platform Module Strategy
356+
326357
- **Shared modules** in `common/` contain ALL cross-platform configuration
327358
- **Platform modules** in `systems/{arch}/` are minimal - only truly platform-specific settings
328359
- **Import chains**:
@@ -331,14 +362,17 @@ The configuration uses a layered import system that eliminates duplication:
331362
- **DRY principle**: Zero duplication between platforms - shared config centralized once
332363

333364
### Performance Optimizations
365+
334366
Built-in performance tuning throughout:
367+
335368
- **Build parallelization**: `max-jobs = "auto"`, `cores = 0`
336369
- **Download optimization**: 256MB buffer, 50 HTTP connections
337370
- **Store optimization**: `nix.optimise.automatic = true` on macOS only (in `systems/aarch64-darwin/default.nix`)
338371
- **CRITICAL**: Do NOT set `nix.optimise` in `common/default.nix` - it only works with nix-darwin, not home-manager
339372
- Linux uses standard nix settings without `optimise.automatic`
340373

341374
### State Management Architecture
375+
342376
- **Version pinning**: `common/versions.nix` prevents Home Manager version conflicts
343377
- **Hostname detection**: Auto-detects via `scutil --get LocalHostName` (macOS)
344378
- **Username validation**: Runtime validation with helpful error messages
@@ -347,6 +381,7 @@ Built-in performance tuning throughout:
347381
## Critical Implementation Patterns
348382

349383
### Module Import Best Practices
384+
350385
```nix
351386
# ✅ Correct: Import with proper parameter passing
352387
./common/module.nix
@@ -359,13 +394,16 @@ Built-in performance tuning throughout:
359394
```
360395

361396
### Configuration Override Hierarchy
397+
362398
1. **flake.nix**: System-level overrides
363399
2. **systems/{arch}/default.nix**: Platform-specific overrides
364400
3. **common/**: Shared defaults
365401
4. **Individual modules**: Specific functionality
366402

367403
### ZSH Configuration Pattern
404+
368405
**IMPORTANT**: ZSH configuration uses `initContent` (not deprecated `initExtra`):
406+
369407
- **common/programs/default.nix** sets base `programs.zsh.initContent`
370408
- **Platform configs** can extend with their own `programs.zsh.initContent` for platform-specific init
371409
- **Platform aliases** set via `programs.zsh.shellAliases` merge with shared aliases from `common/zsh/shared.nix`
@@ -382,26 +420,31 @@ Built-in performance tuning throughout:
382420
- `tools` - Tool initialization (fzf, zoxide, oh-my-posh, carapace)
383421

384422
### Error Handling Patterns
423+
385424
The codebase implements defensive configuration:
425+
386426
- **Validation functions**: `validateUsername` with helpful error messages
387427
- **Fallback options**: `fallback = true` in Nix settings
388428
- **Graceful degradation**: Optional features with null checks
389429

390430
## Security Architecture
391431

392432
### SSH Key Management
433+
393434
- **1Password integration**: SSH agent socket configuration for seamless key access
394435
- **Per-platform paths**: macOS uses Library/Group Containers path
395436
- **Automatic setup**: System activation scripts configure SSH properly
396437

397438
### Credential Isolation
439+
398440
- **Home Manager**: User-level secrets and configurations
399441
- **System-level**: Only essential system packages and settings
400442
- **Cloud integration**: AWS profiles, Tailscale for secure connectivity
401443

402444
## Code Quality Standards
403445

404446
**6 Golden Rules for Clean Code** (Neo Kim):
447+
405448
1. **SOC** - Separation of concerns
406449
2. **DYC** - Document your code
407450
3. **DRY** - Don't repeat yourself
@@ -410,6 +453,7 @@ The codebase implements defensive configuration:
410453
6. **YAGNI** - You ain't gonna need it
411454

412455
### Nix-Specific Quality Guidelines
456+
413457
- **Pure functions**: All configuration functions should be deterministic
414458
- **Explicit dependencies**: Always declare inputs explicitly
415459
- **Modular design**: Each .nix file should have single responsibility

systems/aarch64-darwin/aerospace/aerospace.toml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ after-login-command = []
66
# You can use it to add commands that run after AeroSpace startup.
77
# 'after-startup-command' is run after 'after-login-command'
88
# Available commands : https://nikitabobko.github.io/AeroSpace/commands
9-
# after-startup-command = [
10-
# 'exec-and-forget borders active_color=0xffe1e3e4 inactive_color=0xff494d64 width=6.0 blacklist="iPhone Mirroring"'
11-
# ]
9+
after-startup-command = [
10+
'exec-and-forget borders active_color=0xff494d64 inactive_color=0x00000000 width=3.0 blacklist="iPhone Mirroring"'
11+
]
1212

1313
# Notify Sketchybar about workspace change
1414
exec-on-workspace-change = [
@@ -60,7 +60,7 @@ inner.horizontal = 10
6060
inner.vertical = 10
6161
outer.left = 10
6262
outer.bottom = 10
63-
outer.top = 42
63+
outer.top = 28
6464
outer.right = 10
6565

6666
# Main keybindings
@@ -93,6 +93,8 @@ alt-3 = 'workspace 3'
9393
alt-4 = 'workspace 4'
9494
alt-5 = 'workspace 5'
9595
alt-6 = 'workspace 6'
96+
alt-7 = 'workspace 7'
97+
alt-8 = 'workspace 8'
9698

9799
# See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
98100
alt-shift-1 = ['move-node-to-workspace 1', 'workspace 1']
@@ -101,6 +103,8 @@ alt-shift-3 = ['move-node-to-workspace 3', 'workspace 3']
101103
alt-shift-4 = ['move-node-to-workspace 4', 'workspace 4']
102104
alt-shift-5 = ['move-node-to-workspace 5', 'workspace 5']
103105
alt-shift-6 = ['move-node-to-workspace 6', 'workspace 6']
106+
alt-shift-7 = ['move-node-to-workspace 7', 'workspace 7']
107+
alt-shift-8 = ['move-node-to-workspace 8', 'workspace 8']
104108

105109
alt-shift-f = 'fullscreen'
106110

@@ -146,16 +150,18 @@ alt-shift-l = ['join-with right', 'mode main']
146150
2 = ['main']
147151
3 = ['main']
148152
4 = ['main']
149-
5 = ['secondary']
150-
6 = ['secondary']
153+
5 = ['main']
154+
6 = ['main']
155+
7 = ['main']
156+
8 = ['main']
151157

152158
# Workspace assignments
153159
[[on-window-detected]]
154-
if.app-id = "company.thebrowser.Browser"
160+
if.app-id = "com.mitchellh.ghostty"
155161
run = "move-node-to-workspace 1"
156162

157163
[[on-window-detected]]
158-
if.app-id = "com.mitchellh.ghostty"
164+
if.app-id = "company.thebrowser.Browser"
159165
run = "move-node-to-workspace 2"
160166

161167
[[on-window-detected]]
@@ -170,7 +176,3 @@ run = "move-node-to-workspace 4"
170176
[[on-window-detected]]
171177
if.app-id = "com.1password.1password"
172178
run = "layout floating"
173-
174-
[[on-window-detected]]
175-
if.app-id = "notion.id"
176-
run = "layout floating"

systems/aarch64-darwin/homebrew.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
# Networking & VPN
4141
"tailscale-app"
42+
"mullvad-vpn@beta"
4243

4344
# Media & Entertainment
4445
"spotify"

0 commit comments

Comments
 (0)