Compare commits
471 Commits
spotifyd
...
polecat/fu
| Author | SHA1 | Date | |
|---|---|---|---|
| 757ff49541 | |||
| 1b585847ab | |||
| e7906331dc | |||
| dc722843a9 | |||
| 03f169284d | |||
| 8908500073 | |||
| 87f6d5c759 | |||
| a851c2551c | |||
|
|
6cf63e86c1 | ||
| c3ed6c0a26 | |||
|
|
53fa89b2e9 | ||
| 3acf9d2796 | |||
| 123e7d3b3a | |||
|
|
56097aefa4 | ||
| 21a8b5c5d9 | |||
| 8f8582b0f3 | |||
| 94fb5a3e64 | |||
| 7df68ba8c8 | |||
| 2799632308 | |||
| 346c031278 | |||
| 188d2befb0 | |||
| 8e8b5f4304 | |||
| 4098ee3987 | |||
| e1e37da7c2 | |||
| a46d11a770 | |||
|
|
8553b9826e | ||
| a0c081e12e | |||
| d92e4b3ddf | |||
| 70b40966be | |||
| 475a633ab7 | |||
| a39416c9db | |||
| 63c3f4e84d | |||
| baf64f7f4a | |||
|
|
f0b6ede7ed | ||
| d0cb16391f | |||
| d872293f19 | |||
| 07182cfdcf | |||
|
|
65e91c20f7 | ||
|
|
01e376eac4 | ||
|
|
9c5be2e27a | ||
|
|
d9ffb14db5 | ||
|
|
07ea05afab | ||
|
|
4f5108c9d9 | ||
| 9243341ed7 | |||
|
|
b729ee8c7a | ||
|
|
ebc28cebd4 | ||
| c82358d586 | |||
| 74388e8c24 | |||
|
|
a98ccddab1 | ||
| 18570628a5 | |||
|
|
0c484b6601 | ||
|
|
4853a18474 | ||
|
|
8b8453a37a | ||
|
|
2b6e289b9a | ||
|
|
70d364544f | ||
|
|
1ffa8524f0 | ||
|
|
be3c27e868 | ||
| c2d286087f | |||
|
|
1172818062 | ||
|
|
9f63e1430c | ||
| b14ef1f62a | |||
| 87719fa9e6 | |||
| 933612da4c | |||
|
|
d2c7599267 | ||
|
|
3d16824eac | ||
| 2cdc15163c | |||
| a77b1230fe | |||
| 623a387127 | |||
| 737f2b09e4 | |||
| cddc9de14a | |||
| 53e3bbe78f | |||
| c258eafe34 | |||
| 03d0b76f97 | |||
| b5f7233214 | |||
| 1203662237 | |||
| 6ad714b57c | |||
| 5440214295 | |||
| cc305af899 | |||
| c06adec7d8 | |||
| 7903b2dfd0 | |||
| f472aa9b3d | |||
| 2e07454ffa | |||
| daf963b290 | |||
| c3c8688f31 | |||
| 1cee1cd365 | |||
| 66c27da142 | |||
| 7d6f71f4e4 | |||
| 7091ee3ad5 | |||
| d78e089695 | |||
| 28b7a0fda9 | |||
| b7bccb0b40 | |||
| 2d03714934 | |||
| 3f0e381de2 | |||
| 1d9fd0aee9 | |||
| 16f6dfcec7 | |||
| 90ef70eb2e | |||
| 667f5b28dc | |||
| 4bb71d0b7e | |||
| 0bc134f557 | |||
| 1b9df3926e | |||
| bd98793528 | |||
| d78637cf13 | |||
| 08d16bd2c9 | |||
| a14ff9be4d | |||
| 90217ec85a | |||
| f99f4069f0 | |||
| 320a2d3738 | |||
| 92b6cfb710 | |||
| 996fb86ed8 | |||
| 47e2392a56 | |||
| c26a11a9a8 | |||
| 7ba1b52ec7 | |||
| 056c1a1e62 | |||
| c92a82b21a | |||
| b6e9de0f61 | |||
| ba4922981b | |||
| 47aaad2eb5 | |||
| 8eca8204ff | |||
| 082b0918af | |||
| 7a5f167a8c | |||
| 9e1003d4fc | |||
| bf600987e9 | |||
| 346ad3665d | |||
| 565acb1632 | |||
| b05c6d8c30 | |||
| 0f555fdd57 | |||
| 9973273b5e | |||
| f281384b69 | |||
| 4eec701729 | |||
| bbcb13881f | |||
| c28d6a7896 | |||
| 79ff0b8aa4 | |||
| 1d9249ea83 | |||
| 2fdd2d5345 | |||
| 722cb315dc | |||
| e042acff16 | |||
| 4fe531f87f | |||
| 266dee9f8f | |||
| 38395c238f | |||
| e4a1771f48 | |||
| ff1fb245ac | |||
| 82fb1738c1 | |||
| 425e4f4cee | |||
| 0e5b11e55d | |||
| 1ba1a8fc9d | |||
| 009b84656f | |||
| ef4e4509d3 | |||
| cd6b528692 | |||
| 3914b54c73 | |||
| 9aa74258f9 | |||
| 64dda20aa4 | |||
| ac01548e89 | |||
| bb7f79843b | |||
| c1d6663a36 | |||
| 3cf4403ffa | |||
| 4e6123de9a | |||
| 19ee298b71 | |||
| 537f7831a7 | |||
| bf0d16fe1a | |||
| 858b6009ae | |||
| 40b323dcfd | |||
| 60bd89b02c | |||
| 5a5de7353b | |||
| e25aa7acab | |||
| 4a284de8a1 | |||
| 7be694ef66 | |||
| 0ccfc30c73 | |||
| dab96a1c50 | |||
| 7898def044 | |||
| 4ce48313f6 | |||
| 2c70504c43 | |||
| a22c7fec28 | |||
| ef3e9b8c82 | |||
| 0590dad71e | |||
| c81594af01 | |||
| 6f999882d3 | |||
| 8bb20bf05e | |||
| c480bcdd1d | |||
| 05fed3ede1 | |||
| 0a9de8d159 | |||
| 055d6ab421 | |||
| d5c6342b84 | |||
| e04dacdf65 | |||
| 7d74917bdc | |||
| 5a4ab71849 | |||
| bcebf9b376 | |||
| 0f76939983 | |||
| a1da2f5cc1 | |||
| 175da48170 | |||
| ac956ef48c | |||
| 0c1190f39c | |||
| 00f05d1bb2 | |||
| 4e6c6ab81d | |||
| 04e1a8563c | |||
| 7278dc8306 | |||
| 066eea2999 | |||
| 80633142fb | |||
| 3029e3d9a8 | |||
| 3483e26bce | |||
| b3add6ddf8 | |||
| 89994e3fc8 | |||
| 0e9671a45f | |||
| f4078970b2 | |||
| 0ae4d84ca2 | |||
| 7c877fde84 | |||
| d53286e04c | |||
| bc42c4dc77 | |||
| 445b0cd558 | |||
| 6d9686f14b | |||
| 4164832eea | |||
| 585f9ef5c7 | |||
| ade60ba5ec | |||
| 48fb7cdada | |||
| 2d8cfe75a0 | |||
| 385fd798de | |||
| fe6558e0c1 | |||
| b9c48f9dd1 | |||
| 34351403d1 | |||
| 12820ce9ff | |||
| 0f5eb2e572 | |||
| f356c91fdb | |||
| 6b42612135 | |||
| 50a8c44d10 | |||
| 7011fb27a5 | |||
| 1ff8b81f44 | |||
| 55f13dfb08 | |||
| 63bf19b85f | |||
| 1f9e9138ab | |||
| e218822566 | |||
| e88f3580e9 | |||
| 5451e75480 | |||
| fc9474a7c9 | |||
| 20daebbd61 | |||
| 3be23304c4 | |||
| 9059a739a0 | |||
| 977125645b | |||
| a9772259f0 | |||
| 4f6d65316a | |||
| 0b8e3bf527 | |||
| d3c906134b | |||
| 30b616dd93 | |||
| c9252c42c2 | |||
| fa7cb55c78 | |||
| 2283b0a6df | |||
| 4ea9437bb0 | |||
| d0760a22bd | |||
| f67a12c29a | |||
| fc8a43504d | |||
| 4a73b3a5ae | |||
| be68202523 | |||
| 608fed35ab | |||
| c2e2dd8675 | |||
| 5750f737f1 | |||
| c27518e0dc | |||
| 7f318edc4d | |||
| f995240153 | |||
| d62bae0ddb | |||
| 79ae42f41d | |||
| 0c15aad5c0 | |||
| d87793d39b | |||
| fad6e61aac | |||
| 1bc65ceb51 | |||
| bda76c6abc | |||
| c42e09e972 | |||
| 4d986c0b48 | |||
| 4e3fdd78d2 | |||
| d3703fc5a9 | |||
| 35c2ebb592 | |||
| 569ac528a5 | |||
| 6cc8fa4f5d | |||
| 67a82f14fd | |||
| 4b68e3f051 | |||
| 81a3657759 | |||
| 32e1b81034 | |||
| 6f00c72540 | |||
| d26007aa61 | |||
| 1caa8bba3e | |||
| d3cb09040a | |||
| 4bfacffa17 | |||
| a6961f05ca | |||
| b75c43257b | |||
| 63d741e55e | |||
| 9ed3ad8fb8 | |||
| 330cd6f92b | |||
| 3b9d9ed60b | |||
| 2a017f584b | |||
| 47c4e0097e | |||
| 2b7cf66e69 | |||
| eed88a9ac0 | |||
| c02b74cce4 | |||
| 1132dda8a0 | |||
| 2696262ed3 | |||
| 40ac30c78f | |||
| ac986e37e7 | |||
| d3664fcf9d | |||
| 5591087be1 | |||
| 09a701989c | |||
| 62dbf84b4b | |||
| 81799cd6d2 | |||
| 35d965e432 | |||
| 2c4e6cc060 | |||
| 5c6dba77f0 | |||
| a6effa3944 | |||
| 0d53b86fcb | |||
| 6bf5c502d8 | |||
| 05592a9ec2 | |||
| 923aaf9e95 | |||
| 23b1c450a2 | |||
| a65a8e9af7 | |||
| 56b1111f54 | |||
| 6bf0a37533 | |||
| 396c8e0318 | |||
| b359acfcf0 | |||
| 455181365a | |||
| 06dd292524 | |||
| 8924fdbc6d | |||
| 671dc229de | |||
| 14cdee1468 | |||
| c6276c9758 | |||
| 31880e21e8 | |||
| 3d95995ebc | |||
| fb9dd66cf4 | |||
| a90b30eb1c | |||
| b22a4952e5 | |||
| 32f70d46b2 | |||
| d76e9e73f5 | |||
| 53504ffde3 | |||
| e5be1b5675 | |||
| 878962ad41 | |||
| 6d5eadcf6a | |||
| c323d1301b | |||
| 6cdbd2e300 | |||
| f0bf2f2d8c | |||
| 9d6abce8cc | |||
| 68f63db930 | |||
| 2e39984d14 | |||
| 9fed36e6ee | |||
| 38a8997448 | |||
| a3c8995422 | |||
| b9bb5d387f | |||
| e3aff80a97 | |||
| 574c8e6482 | |||
| 0f59a558cd | |||
| 14b7de30f6 | |||
| 8b676203e7 | |||
| beeb7acefd | |||
| a512d9bc06 | |||
| cc3d398963 | |||
| f757ea7271 | |||
| 64149713d2 | |||
| 88b413e0af | |||
| c5070eb4bf | |||
| 6b4dc1e6b7 | |||
| aadd8c7b6c | |||
| f8d145b495 | |||
| 9232d46f6a | |||
| b2b34fc05f | |||
| aa4dacb3af | |||
| 6dc4d6956a | |||
| be83fc566f | |||
| 485df44aea | |||
| 4861128de6 | |||
| 9fe7cfbbfc | |||
| 741e3a67d6 | |||
| 22254eb1f3 | |||
| 79dde1a0fe | |||
| f4b3c36a4e | |||
| 1fa7a2689c | |||
| c08c5e2486 | |||
| ecaa6dcb83 | |||
| 7729ff7434 | |||
| 52c110a505 | |||
| d5997575df | |||
| 57bc35101e | |||
| 6b09b1b0bc | |||
| 1851743a21 | |||
| c6d787f9f5 | |||
| f4a8f9d614 | |||
| 1e01d44f2f | |||
| 39dbe6644c | |||
| 870e1073dc | |||
| c1f132026a | |||
| 5650125d7e | |||
| 6536213bd0 | |||
| a0ce3b810e | |||
| abbcfebc97 | |||
| 495aba3fef | |||
| f9bcec74d3 | |||
| 97c4d7035c | |||
| 8abd331619 | |||
| aca0afa0dc | |||
| 1d0b3a0367 | |||
| 50f9defdd5 | |||
| d71d7a1ffb | |||
| ee511f6ab8 | |||
| e3dd0bdb30 | |||
| 10300ed10b | |||
| 8e72ef71d2 | |||
| d6e031efd0 | |||
| 16fa4a641c | |||
| 7a5ec23cc5 | |||
| ff1124fbe6 | |||
| 53088f9536 | |||
| 68c04b43fd | |||
| efbfffbb61 | |||
| 0e1a67b980 | |||
| 7d6e294340 | |||
| 8690a0289d | |||
| e95f56e240 | |||
| 2dffbb0a98 | |||
| 2ceaf78825 | |||
| e164097f36 | |||
| d1605e386d | |||
| 4a41533ba8 | |||
| 9d45449fce | |||
| 877bc2c739 | |||
| cd6e028142 | |||
| 421b27f76f | |||
| 1f4a72d28c | |||
| a8f19af989 | |||
| d4b0fe5b9e | |||
| 09cff42222 | |||
| 0183e7c823 | |||
| 29cdd1e239 | |||
| 7ced8f11ba | |||
| 244b7c0888 | |||
| 80744bcbf1 | |||
| 56d03f4228 | |||
| 32d0c7fa5a | |||
| 1c2aae93b7 | |||
| 0ab6562694 | |||
| 986ee06a46 | |||
| 34abaeeec9 | |||
| 11638cfa1b | |||
| 1ce431b0e5 | |||
| 98ef9b1443 | |||
| 4c779663df | |||
| e2bb87fcf1 | |||
| ef47c5dc9a | |||
| 7da089daa3 | |||
| 8134d7cb33 | |||
| 24f1a64f3c | |||
| 19531074ca | |||
| a30c130f21 | |||
| e088ee2dc8 | |||
| 366a7e2ea3 | |||
| 9116e44dfe | |||
| e3ef710bdb | |||
| e1a804cfed | |||
| ec59936012 | |||
| 844d17a855 | |||
| b19dc65c6d | |||
| 6db2c78e0b | |||
| 475aafa33e | |||
| 09562f0af9 | |||
| ae543d9628 | |||
| c7716d2bca | |||
| 54cf339d52 | |||
| b9097e91d5 | |||
| abf8fe9ad2 | |||
| 926b47f07f | |||
| 749ef988f1 | |||
| dfa91d327f | |||
| 37c455d75e | |||
| c0d7d934f3 | |||
| cb91f69c49 | |||
| bc6378cb22 | |||
| a13676311a | |||
| ec57592715 | |||
| 051c223eb7 | |||
| 6030f6ea42 |
44
.beads/.gitignore
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# SQLite databases
|
||||
*.db
|
||||
*.db?*
|
||||
*.db-journal
|
||||
*.db-wal
|
||||
*.db-shm
|
||||
|
||||
# Daemon runtime files
|
||||
daemon.lock
|
||||
daemon.log
|
||||
daemon.pid
|
||||
bd.sock
|
||||
sync-state.json
|
||||
last-touched
|
||||
|
||||
# Local version tracking (prevents upgrade notification spam after git ops)
|
||||
.local_version
|
||||
|
||||
# Legacy database files
|
||||
db.sqlite
|
||||
bd.db
|
||||
|
||||
# Worktree redirect file (contains relative path to main repo's .beads/)
|
||||
# Must not be committed as paths would be wrong in other clones
|
||||
redirect
|
||||
|
||||
# Merge artifacts (temporary files from 3-way merge)
|
||||
beads.base.jsonl
|
||||
beads.base.meta.json
|
||||
beads.left.jsonl
|
||||
beads.left.meta.json
|
||||
beads.right.jsonl
|
||||
beads.right.meta.json
|
||||
|
||||
# Sync state (local-only, per-machine)
|
||||
# These files are machine-specific and should not be shared across clones
|
||||
.sync.lock
|
||||
sync_base.jsonl
|
||||
|
||||
# NOTE: Do NOT add negation patterns (e.g., !issues.jsonl) here.
|
||||
# They would override fork protection in .git/info/exclude, allowing
|
||||
# contributors to accidentally commit upstream issue databases.
|
||||
# The JSONL files (issues.jsonl, interactions.jsonl) and config files
|
||||
# are tracked by git by default since no pattern above ignores them.
|
||||
0
.beads/.sync.lock
Normal file
81
.beads/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Beads - AI-Native Issue Tracking
|
||||
|
||||
Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
|
||||
|
||||
## What is Beads?
|
||||
|
||||
Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
|
||||
|
||||
**Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
# Create new issues
|
||||
bd create "Add user authentication"
|
||||
|
||||
# View all issues
|
||||
bd list
|
||||
|
||||
# View issue details
|
||||
bd show <issue-id>
|
||||
|
||||
# Update issue status
|
||||
bd update <issue-id> --status in_progress
|
||||
bd update <issue-id> --status done
|
||||
|
||||
# Sync with git remote
|
||||
bd sync
|
||||
```
|
||||
|
||||
### Working with Issues
|
||||
|
||||
Issues in Beads are:
|
||||
- **Git-native**: Stored in `.beads/issues.jsonl` and synced like code
|
||||
- **AI-friendly**: CLI-first design works perfectly with AI coding agents
|
||||
- **Branch-aware**: Issues can follow your branch workflow
|
||||
- **Always in sync**: Auto-syncs with your commits
|
||||
|
||||
## Why Beads?
|
||||
|
||||
✨ **AI-Native Design**
|
||||
- Built specifically for AI-assisted development workflows
|
||||
- CLI-first interface works seamlessly with AI coding agents
|
||||
- No context switching to web UIs
|
||||
|
||||
🚀 **Developer Focused**
|
||||
- Issues live in your repo, right next to your code
|
||||
- Works offline, syncs when you push
|
||||
- Fast, lightweight, and stays out of your way
|
||||
|
||||
🔧 **Git Integration**
|
||||
- Automatic sync with git commits
|
||||
- Branch-aware issue tracking
|
||||
- Intelligent JSONL merge resolution
|
||||
|
||||
## Get Started with Beads
|
||||
|
||||
Try Beads in your own projects:
|
||||
|
||||
```bash
|
||||
# Install Beads
|
||||
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
||||
|
||||
# Initialize in your repo
|
||||
bd init
|
||||
|
||||
# Create your first issue
|
||||
bd create "Try out Beads"
|
||||
```
|
||||
|
||||
## Learn More
|
||||
|
||||
- **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
|
||||
- **Quick Start Guide**: Run `bd quickstart`
|
||||
- **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
|
||||
|
||||
---
|
||||
|
||||
*Beads: Issue tracking that moves at the speed of thought* ⚡
|
||||
64
.beads/config.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
# Beads Configuration File
|
||||
# This file configures default behavior for all bd commands in this repository
|
||||
# All settings can also be set via environment variables (BD_* prefix)
|
||||
# or overridden with command-line flags
|
||||
|
||||
# Issue prefix for this repository (used by bd init)
|
||||
# If not set, bd init will auto-detect from directory name
|
||||
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
|
||||
issue-prefix: "x"
|
||||
|
||||
# Use no-db mode: load from JSONL, no SQLite, write back after each command
|
||||
# When true, bd will use .beads/issues.jsonl as the source of truth
|
||||
# instead of SQLite database
|
||||
# no-db: false
|
||||
|
||||
# Disable daemon for RPC communication (forces direct database access)
|
||||
# no-daemon: false
|
||||
|
||||
# Disable auto-flush of database to JSONL after mutations
|
||||
# no-auto-flush: false
|
||||
|
||||
# Disable auto-import from JSONL when it's newer than database
|
||||
# no-auto-import: false
|
||||
|
||||
# Enable JSON output by default
|
||||
# json: false
|
||||
|
||||
# Default actor for audit trails (overridden by BD_ACTOR or --actor)
|
||||
# actor: ""
|
||||
|
||||
# Path to database (overridden by BEADS_DB or --db)
|
||||
# db: ""
|
||||
|
||||
# Auto-start daemon if not running (can also use BEADS_AUTO_START_DAEMON)
|
||||
# auto-start-daemon: true
|
||||
|
||||
# Debounce interval for auto-flush (can also use BEADS_FLUSH_DEBOUNCE)
|
||||
# flush-debounce: "5s"
|
||||
|
||||
# Git branch for beads commits (bd sync will commit to this branch)
|
||||
# IMPORTANT: Set this for team projects so all clones use the same sync branch.
|
||||
# This setting persists across clones (unlike database config which is gitignored).
|
||||
# Can also use BEADS_SYNC_BRANCH env var for local override.
|
||||
# If not set, bd sync will require you to run 'bd config set sync.branch <branch>'.
|
||||
sync-branch: "beads-sync"
|
||||
|
||||
# Multi-repo configuration (experimental - bd-307)
|
||||
# Allows hydrating from multiple repositories and routing writes to the correct JSONL
|
||||
# repos:
|
||||
# primary: "." # Primary repo (where this database lives)
|
||||
# additional: # Additional repos to hydrate from (read-only)
|
||||
# - ~/beads-planning # Personal planning repo
|
||||
# - ~/work-planning # Work planning repo
|
||||
|
||||
# Integration settings (access with 'bd config get/set')
|
||||
# These are stored in the database, not in this file:
|
||||
# - jira.url
|
||||
# - jira.project
|
||||
# - linear.url
|
||||
# - linear.api-key
|
||||
# - github.org
|
||||
# - github.repo
|
||||
|
||||
routing.mode: "explicit"
|
||||
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
# Use bd merge for beads JSONL files
|
||||
.beads/issues.jsonl merge=beads
|
||||
67
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: https://git.johnogle.info/johno/gitea-actions/nix-setup@v1
|
||||
|
||||
- name: Check flake
|
||||
run: nix flake check
|
||||
env:
|
||||
NIX_CONFIG: "access-tokens = git.johnogle.info=${{ secrets.GITEA_ACCESS_TOKEN }}"
|
||||
|
||||
build-and-cache:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
machine:
|
||||
- nix-book
|
||||
- boxy
|
||||
- zix790prors
|
||||
- nix-deck
|
||||
- john-endesktop
|
||||
- live-usb
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: https://git.johnogle.info/johno/gitea-actions/nix-setup@v1
|
||||
|
||||
- name: Build ${{ matrix.machine }}
|
||||
id: build
|
||||
run: |
|
||||
OUT_PATH=$(nix build .#nixosConfigurations.${{ matrix.machine }}.config.system.build.toplevel --no-link --print-out-paths)
|
||||
echo "out_path=$OUT_PATH" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
NIX_CONFIG: "access-tokens = git.johnogle.info=${{ secrets.GITEA_ACCESS_TOKEN }}"
|
||||
|
||||
- name: Sign and push to cache
|
||||
run: |
|
||||
# Write signing key
|
||||
echo "${{ secrets.NIX_SIGNING_KEY }}" > /tmp/signing-key
|
||||
chmod 600 /tmp/signing-key
|
||||
|
||||
# Sign the closure
|
||||
nix store sign --key-file /tmp/signing-key -r "${{ steps.build.outputs.out_path }}"
|
||||
|
||||
# Setup SSH key for cache push
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.CACHE_SSH_KEY }}" > ~/.ssh/cache_key
|
||||
chmod 600 ~/.ssh/cache_key
|
||||
ssh-keyscan -H ${{ secrets.CACHE_HOST }} >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
|
||||
# Push to cache
|
||||
nix copy --to "ssh-ng://${{ secrets.CACHE_USER }}@${{ secrets.CACHE_HOST }}?ssh-key=$HOME/.ssh/cache_key" "${{ steps.build.outputs.out_path }}"
|
||||
env:
|
||||
NIX_CONFIG: "access-tokens = git.johnogle.info=${{ secrets.GITEA_ACCESS_TOKEN }}"
|
||||
7
.gitignore
vendored
@@ -1 +1,8 @@
|
||||
result
|
||||
thoughts
|
||||
.beads
|
||||
|
||||
# Gas Town (added by gt)
|
||||
.runtime/
|
||||
.claude/
|
||||
.logs/
|
||||
|
||||
21
.goosehints
Normal file
@@ -0,0 +1,21 @@
|
||||
NixOS Configurations Repository
|
||||
================================
|
||||
|
||||
Overview:
|
||||
---------
|
||||
This repository hosts modular and reproducible NixOS configurations managed via Nix flakes. It is structured to separate concerns across machine-specific setups, common roles, and custom packages.
|
||||
|
||||
Directory Structure:
|
||||
----------------------
|
||||
• packages/ - Custom Nix packages leveraged across various configurations.
|
||||
• roles/ - Role-based configurations (e.g., kodi, bluetooth) each with its own module (default.nix) for inclusion in machine setups.
|
||||
• machines/ - Machine-specific configurations (e.g., nix-book, zix790prors, boxy) including configuration.nix and hardware-configuration.nix tailored for each hardware.
|
||||
• home/ - Home-manager configurations for personal environments and application settings (e.g., home-nix-book.nix, home-z790prors.nix).
|
||||
|
||||
Design Principles:
|
||||
------------------
|
||||
• Modularity: Clear separation between roles, machines, and packages allows for flexible and reusable configurations.
|
||||
• Declarative & Reproducible: Using Nix flakes guarantees a fully declarative setup that can be effortlessly reproduced across systems.
|
||||
• Scalability: The structure is designed to accommodate adding new roles or machines with minimal disruption to existing configurations.
|
||||
|
||||
This file serves as a concise guide for navigating and understanding the repository from an advanced Nix perspective. Further documentation can be found within the respective directories or individual README files where applicable.
|
||||
11
.sops.yaml
@@ -1,11 +0,0 @@
|
||||
keys:
|
||||
- &admin_johno age1ls6a033d4p4u8h4rwazjwt8w4c4xg73wq0mdnm64jajxzcz4k9asvjnks3
|
||||
- &host_z790prors age12l5u7sw59u5pkwp83qm8t3ff7uv0ld2c9k3zh5j4ame9k2szcynqu7ftqe
|
||||
- &host_nixbook age1fa3zqavfmqk4ssa22yne9td90gyqv9q5a8y0s8jp3xak8q7p3yjqyn7rkg
|
||||
creation_rules:
|
||||
- path_regex: secrets/[^/]+\.(yaml|json|env|ini)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *admin_johno
|
||||
- *host_z790prors
|
||||
- *host_nixbook
|
||||
231
AGENTS.md
Normal file
@@ -0,0 +1,231 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Repository Overview
|
||||
|
||||
This is a NixOS configuration repository using flakes, managing multiple machines and home-manager configurations. The repository follows a modular architecture with reusable "roles" that can be composed for different machines.
|
||||
|
||||
## Issue Tracking
|
||||
|
||||
This repository uses `beads` for issue tracking and management. Run `bd quickstart` to get an overview of the system at the start of every session.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Flake Structure
|
||||
- **flake.nix**: Main entry point defining inputs (nixpkgs, home-manager, plasma-manager, etc.) and outputs for multiple NixOS configurations
|
||||
- **Machines**: `nix-book`, `boxy`, `zix790prors`, `live-usb`, `johno-macbookpro` (Darwin/macOS)
|
||||
- **Home configurations**: Standalone home-manager configuration for user `johno`
|
||||
|
||||
### Directory Structure
|
||||
- `machines/`: Machine-specific configurations with hardware-configuration.nix
|
||||
- `roles/`: Modular system configurations (audio, bluetooth, desktop, users, etc.)
|
||||
- `home/`: Home Manager configurations and user-specific modules
|
||||
- `home/modules/`: User environment modules (emacs, i3+sway, plasma-manager, tmux)
|
||||
- `packages/`: Custom package definitions
|
||||
|
||||
### Role-Based Configuration System
|
||||
The repository uses a custom "roles" system where each role is a NixOS module with enable options:
|
||||
- `roles.desktop`: Desktop environment with sub-options for X11, Wayland, KDE, gaming, SDDM
|
||||
- `roles.audio`: Audio configuration
|
||||
- `roles.bluetooth`: Bluetooth support
|
||||
- `roles.users`: User account management
|
||||
- `roles.virtualisation`: Virtualization setup
|
||||
- `roles.kodi`: Kodi media center
|
||||
- `roles.nvidia`: NVIDIA GPU configuration
|
||||
- `roles.printing`: Printing support (CUPS)
|
||||
- `roles.spotifyd`: Spotify daemon
|
||||
- `roles.btrfs`: Btrfs filesystem configuration
|
||||
- `roles.nfs-mounts`: NFS mount configuration
|
||||
- `roles.darwin`: macOS-specific configurations
|
||||
|
||||
Example role usage in machine configuration:
|
||||
```nix
|
||||
roles = {
|
||||
audio.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
gaming = true;
|
||||
kde = true;
|
||||
wayland = true;
|
||||
};
|
||||
users.enable = true;
|
||||
};
|
||||
```
|
||||
|
||||
### Home-Manager Role System
|
||||
The repository also uses a modular home-manager role system for user-space configuration:
|
||||
|
||||
**Available Home Roles:**
|
||||
- `home.roles.base`: Core CLI tools, git, ssh, bash, rbw (enabled everywhere)
|
||||
- `home.roles.desktop`: GUI applications, Firefox, KDE services
|
||||
- `home.roles.office`: LibreOffice, OpenSCAD (heavy packages)
|
||||
- `home.roles.media`: VLC, Jellyfin, Moonlight (media consumption)
|
||||
- `home.roles.development`: Custom packages, kubectl, development tools
|
||||
- `home.roles.communication`: Element, Nextcloud Talk, Google cookie tools
|
||||
- `home.roles.sync`: Syncthing service and tray (for file synchronization)
|
||||
- `home.roles.kdeconnect`: KDE Connect for device integration
|
||||
- `home.roles.gaming`: Gaming applications (future expansion)
|
||||
|
||||
**Role-Based Home Configurations:**
|
||||
- `home-desktop.nix`: Full-featured desktop for development workstations
|
||||
- `home-media-center.nix`: Living room media consumption and gaming setup (boxy)
|
||||
- `home-laptop-compact.nix`: Essential tools only, excludes office/media for storage constraints (nix-book)
|
||||
- `home-live-usb.nix`: Minimal setup for live environments, no persistent services
|
||||
- `home-darwin-work.nix`: macOS work laptop configuration
|
||||
|
||||
**Machine-Specific Role Usage:**
|
||||
- **nix-book**: Compact laptop → excludes office/media roles due to SSD space constraints
|
||||
- **boxy**: Living room media center → optimized for media consumption, excludes sync/office (shared machine)
|
||||
- **zix790prors**: All-purpose workstation → full desktop experience with all roles enabled
|
||||
- **live-usb**: Temporary environment → only base + desktop roles, no persistent services
|
||||
- **johno-macbookpro**: macOS work laptop → Darwin-specific configuration with development tools
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Building and Switching Configurations
|
||||
|
||||
**NixOS (Linux):**
|
||||
```bash
|
||||
# Build and switch to a specific machine configuration
|
||||
sudo nixos-rebuild switch --flake .#<hostname>
|
||||
|
||||
# Build without switching
|
||||
nixos-rebuild build --flake .#<hostname>
|
||||
|
||||
# Build home-manager configuration only
|
||||
home-manager switch --flake .#johno
|
||||
```
|
||||
|
||||
**Darwin (macOS):**
|
||||
```bash
|
||||
# Build and switch to Darwin configuration
|
||||
darwin-rebuild switch --flake .#johno-macbookpro
|
||||
|
||||
# Build without switching
|
||||
darwin-rebuild build --flake .#johno-macbookpro
|
||||
```
|
||||
|
||||
### Available Machine Configurations
|
||||
- `nix-book`: Compact laptop with storage constraints, uses `home/home-laptop-compact.nix`
|
||||
- `boxy`: Shared living room media center/gaming desktop with AMD GPU, uses `home/home-media-center.nix`
|
||||
- `zix790prors`: Powerful all-purpose workstation (gaming, 3D modeling, development), dual-boots Windows 11 with shared btrfs /games partition, uses `home/home-desktop.nix`
|
||||
- `live-usb`: Bootable ISO configuration, uses `home/home-live-usb.nix`
|
||||
- `johno-macbookpro`: macOS work laptop, uses `home/home-darwin-work.nix`
|
||||
|
||||
### Flake Operations
|
||||
```bash
|
||||
# Update flake inputs
|
||||
nix flake update
|
||||
|
||||
# Check flake
|
||||
nix flake check
|
||||
|
||||
# Show flake info
|
||||
nix flake show
|
||||
```
|
||||
|
||||
### Bootstrap New Machine
|
||||
Use the provided bootstrap script:
|
||||
```bash
|
||||
sudo ./bootstrap.sh <hostname>
|
||||
```
|
||||
This script pulls from the remote git repository and applies the configuration.
|
||||
|
||||
### Build Live USB ISO
|
||||
Use the provided script to build a bootable ISO:
|
||||
```bash
|
||||
./build-liveusb.sh
|
||||
```
|
||||
Creates an ISO suitable for Ventoy and other USB boot tools in `./result/iso/`.
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Adding New Machines
|
||||
|
||||
**NixOS:**
|
||||
1. Create new directory in `machines/<hostname>/`
|
||||
2. Add `configuration.nix` with role assignments
|
||||
3. Include hardware-configuration.nix (generated by nixos-generate-config)
|
||||
4. Add nixosConfiguration to flake.nix outputs
|
||||
|
||||
**Darwin (macOS):**
|
||||
1. Create new directory in `machines/<hostname>/`
|
||||
2. Add `configuration.nix` with Darwin role assignments
|
||||
3. Add darwinConfiguration to flake.nix outputs
|
||||
|
||||
### Adding New Roles
|
||||
1. Create directory in `roles/<role-name>/`
|
||||
2. Create `default.nix` with module definition using mkEnableOption
|
||||
3. Add role import to `roles/default.nix`
|
||||
4. Configure role options in machine configurations
|
||||
|
||||
### Home Manager Modules
|
||||
- Located in `home/modules/`
|
||||
- Each module has its own `default.nix`
|
||||
- Imported in main home configuration files
|
||||
|
||||
## Key Configuration Details
|
||||
|
||||
- **Experimental features**: nix-command and flakes are enabled
|
||||
- **User**: Primary user is `johno` with trusted-user privileges
|
||||
- **Locale**: en_US.UTF-8, America/Los_Angeles timezone
|
||||
- **SSH**: OpenSSH enabled on all configurations
|
||||
- **Garbage collection**: Automatic, deletes older than 10 days
|
||||
- **Unfree packages**: Allowed globally
|
||||
|
||||
## Issue Tracking (Gitea)
|
||||
|
||||
**Tea CLI for Gitea:**
|
||||
```bash
|
||||
# Note: When using tea CLI, you must specify --repo johno/nixos-configs
|
||||
# The CLI doesn't automatically detect the repo from git remote
|
||||
|
||||
# List all issues (open by default)
|
||||
tea issues --repo johno/nixos-configs
|
||||
|
||||
# List closed issues
|
||||
tea issues --repo johno/nixos-configs --state closed
|
||||
|
||||
# View specific issue
|
||||
tea issue --repo johno/nixos-configs 2
|
||||
|
||||
# Create new issue
|
||||
tea issues create --repo johno/nixos-configs --title "Issue title" --body "Description"
|
||||
|
||||
# Add comment to issue
|
||||
tea comment --repo johno/nixos-configs 2 "Comment text"
|
||||
|
||||
# Close issue (note: 'issues' is plural, issue number comes last)
|
||||
tea issues close --repo johno/nixos-configs 2
|
||||
```
|
||||
|
||||
## Important Notes
|
||||
|
||||
- **Sudo access**: Claude Code does not have sudo access. Ask the user to run elevated commands like `sudo nixos-rebuild switch`
|
||||
|
||||
## Landing the Plane (Session Completion)
|
||||
|
||||
**When ending a work session**, you MUST complete ALL steps below. Work is NOT complete until `git push` succeeds.
|
||||
|
||||
**MANDATORY WORKFLOW:**
|
||||
|
||||
1. **File issues for remaining work** - Create issues for anything that needs follow-up
|
||||
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
||||
3. **Update issue status** - Close finished work, update in-progress items
|
||||
4. **PUSH TO REMOTE** - This is MANDATORY:
|
||||
```bash
|
||||
git pull --rebase
|
||||
bd sync
|
||||
git push
|
||||
git status # MUST show "up to date with origin"
|
||||
```
|
||||
5. **Clean up** - Clear stashes, prune remote branches
|
||||
6. **Verify** - All changes committed AND pushed
|
||||
7. **Hand off** - Provide context for next session
|
||||
|
||||
**CRITICAL RULES:**
|
||||
- Work is NOT complete until `git push` succeeds
|
||||
- NEVER stop before pushing - that leaves work stranded locally
|
||||
- NEVER say "ready to push when you are" - YOU must push
|
||||
- If push fails, resolve and retry until it succeeds
|
||||
380
flake.lock
generated
@@ -1,5 +1,120 @@
|
||||
{
|
||||
"nodes": {
|
||||
"beads": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769840331,
|
||||
"narHash": "sha256-Yp0K4JoXX8EcHp1juH4OZ7dcCmkopDu4VvAgZEOxgL8=",
|
||||
"owner": "steveyegge",
|
||||
"repo": "beads",
|
||||
"rev": "93965b4abeed920a4701e03571d1b6bb75810722",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "steveyegge",
|
||||
"repo": "beads",
|
||||
"rev": "93965b4abeed920a4701e03571d1b6bb75810722",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"doomemacs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1768984347,
|
||||
"narHash": "sha256-VvC4rgAAaFnYLCdcUoz7dTE3kuBNuHIc+GlXOrPCxpg=",
|
||||
"owner": "doomemacs",
|
||||
"repo": "doomemacs",
|
||||
"rev": "57818a6da90fbef39ff80d62fab2cd319496c3b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "doomemacs",
|
||||
"repo": "doomemacs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"emacs-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nix-doom-emacs-unstraightened"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nix-doom-emacs-unstraightened"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769848312,
|
||||
"narHash": "sha256-ggBocPd1L4l5MFNV0Fw9aSGZZO4aGzCfgh4e6hQ77RE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "be0b4f4f28f69be61e9174807250e3235ee11d50",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gastown": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1770098007,
|
||||
"narHash": "sha256-CFlN57BXlR5FobTChdE2GgdIGx4xJcFFCk1E5Q98cSQ=",
|
||||
"owner": "steveyegge",
|
||||
"repo": "gastown",
|
||||
"rev": "13461161063bf7b2365fe5fd4df88e32c3ba2a28",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "steveyegge",
|
||||
"repo": "gastown",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"google-cookie-retrieval": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1768846578,
|
||||
"narHash": "sha256-82f/+e8HAwmBukiLlr7I3HYvM/2GCd5SOc+BC+qzsOQ=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "c11ff9d3c67372a843a0fa6bf23132e986bd6955",
|
||||
"revCount": 14,
|
||||
"type": "git",
|
||||
"url": "https://git.johnogle.info/johno/google-cookie-retrieval.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.johnogle.info/johno/google-cookie-retrieval.git"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -7,26 +122,165 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728041527,
|
||||
"narHash": "sha256-03liqiJtk9UP7YQHW4r8MduKCK242FQzud8iWvvlK+o=",
|
||||
"lastModified": 1768949235,
|
||||
"narHash": "sha256-TtjKgXyg1lMfh374w5uxutd6Vx2P/hU81aEhTxrO2cg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "509dbf8d45606b618e9ec3bbe4e936b7c5bc6c1e",
|
||||
"rev": "75ed713570ca17427119e7e204ab3590cc3bf2a5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-25.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager-unstable": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769397130,
|
||||
"narHash": "sha256-TTM4KV9IHwa181X7afBRbhLJIrgynpDjAXJFMUOWfyU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "c37679d37bdbecf11bbe3c5eb238d89ca4f60641",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "master",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"jovian": {
|
||||
"inputs": {
|
||||
"nix-github-actions": "nix-github-actions",
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769273817,
|
||||
"narHash": "sha256-+iyLihi/ynJokMgJZMRXuMuI6DPGUQRajz5ztNCHgnI=",
|
||||
"owner": "Jovian-Experiments",
|
||||
"repo": "Jovian-NixOS",
|
||||
"rev": "98f988ad46e31f9956c5f6874dfb3580a7ff3969",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Jovian-Experiments",
|
||||
"repo": "Jovian-NixOS",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767634391,
|
||||
"narHash": "sha256-owcSz2ICqTSvhBbhPP+1eWzi88e54rRZtfCNE5E/wwg=",
|
||||
"owner": "nix-darwin",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "08585aacc3d6d6c280a02da195fdbd4b9cf083c2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-darwin",
|
||||
"ref": "nix-darwin-25.11",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-doom-emacs-unstraightened": {
|
||||
"inputs": {
|
||||
"doomemacs": "doomemacs",
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"nixpkgs": [],
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769849328,
|
||||
"narHash": "sha256-BjH1Ge6O8ObN6Z97un2U87pl4POO99Q8RSsgIuTZq8Q=",
|
||||
"owner": "marienz",
|
||||
"repo": "nix-doom-emacs-unstraightened",
|
||||
"rev": "fc1d7190c49558cdc6af20d7657075943a500a93",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "marienz",
|
||||
"repo": "nix-doom-emacs-unstraightened",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"jovian",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729697500,
|
||||
"narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=",
|
||||
"owner": "zhaofengli",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "zhaofengli",
|
||||
"ref": "matrix-name",
|
||||
"repo": "nix-github-actions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1727802920,
|
||||
"narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=",
|
||||
"lastModified": 1769089682,
|
||||
"narHash": "sha256-9yA/LIuAVQq0lXelrZPjLuLVuZdm03p8tfmHhnDIkms=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515",
|
||||
"rev": "078d69f03934859a181e81ba987c2bb033eebfc5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-qt": {
|
||||
"locked": {
|
||||
"lastModified": 1770464364,
|
||||
"narHash": "sha256-z5NJPSBwsLf/OfD8WTmh79tlSU8XgIbwmk6qB1/TFzY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "23d72dabcb3b12469f57b37170fcbc1789bd7457",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1769170682,
|
||||
"narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c5296fdd05cfa2c187990dd909864da9658df755",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -36,47 +290,113 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"perles": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1725762081,
|
||||
"narHash": "sha256-vNv+aJUW5/YurRy1ocfvs4q/48yVESwlC/yHzjkZSP8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dc454045f5b5d814e5862a6d057e7bb5c29edc05",
|
||||
"lastModified": 1769460725,
|
||||
"narHash": "sha256-zM2jw+emxe8+mNyR1ebMWkQiEx8uSmhoqqI0IxXLDgs=",
|
||||
"owner": "zjrosen",
|
||||
"repo": "perles",
|
||||
"rev": "57b20413eea461452b59e13f5a4a367953b1f768",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "release-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"owner": "zjrosen",
|
||||
"repo": "perles",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plasma-manager": {
|
||||
"inputs": {
|
||||
"home-manager": [
|
||||
"home-manager"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767662275,
|
||||
"narHash": "sha256-d5Q1GmQ+sW1Bt8cgDE0vOihzLaswsm8cSdg8124EqXE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "plasma-manager",
|
||||
"rev": "51816be33a1ff0d4b22427de83222d5bfa96d30e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "plasma-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plasma-manager-unstable": {
|
||||
"inputs": {
|
||||
"home-manager": [
|
||||
"home-manager-unstable"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767662275,
|
||||
"narHash": "sha256-d5Q1GmQ+sW1Bt8cgDE0vOihzLaswsm8cSdg8124EqXE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "plasma-manager",
|
||||
"rev": "51816be33a1ff0d4b22427de83222d5bfa96d30e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "plasma-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"beads": "beads",
|
||||
"gastown": "gastown",
|
||||
"google-cookie-retrieval": "google-cookie-retrieval",
|
||||
"home-manager": "home-manager",
|
||||
"home-manager-unstable": "home-manager-unstable",
|
||||
"jovian": "jovian",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"sops-nix": "sops-nix"
|
||||
"nixpkgs-qt": "nixpkgs-qt",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"perles": "perles",
|
||||
"plasma-manager": "plasma-manager",
|
||||
"plasma-manager-unstable": "plasma-manager-unstable"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1727423009,
|
||||
"narHash": "sha256-+4B/dQm2EnORIk0k2wV3aHGaE0WXTBjColXjj7qWh10=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "127a96f49ddc377be6ba76964411bab11ae27803",
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
|
||||
303
flake.nix
@@ -2,66 +2,301 @@
|
||||
description = "A very basic flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
# Separate nixpkgs for qt5webengine-dependent packages (jellyfin-media-player, etc.)
|
||||
# Updates on separate Renovate schedule to avoid massive qt rebuilds
|
||||
nixpkgs-qt.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
nix-darwin = {
|
||||
url = "github:nix-darwin/nix-darwin/nix-darwin-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
url = "github:nix-community/home-manager/release-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager-unstable = {
|
||||
url = "github:nix-community/home-manager/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
plasma-manager = {
|
||||
url = "github:nix-community/plasma-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.home-manager.follows = "home-manager";
|
||||
};
|
||||
|
||||
plasma-manager-unstable = {
|
||||
url = "github:nix-community/plasma-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
inputs.home-manager.follows = "home-manager-unstable";
|
||||
};
|
||||
|
||||
google-cookie-retrieval = {
|
||||
url = "git+https://git.johnogle.info/johno/google-cookie-retrieval.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
jovian = {
|
||||
url = "github:Jovian-Experiments/Jovian-NixOS";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
beads = {
|
||||
# v0.49.1 has dolt server mode support (gt-1mf.3)
|
||||
# Pinned to 259ddd92 - uses Go 1.24 compatible with nixpkgs
|
||||
url = "github:steveyegge/beads/93965b4abeed920a4701e03571d1b6bb75810722";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
gastown = {
|
||||
url = "github:steveyegge/gastown";
|
||||
flake = false; # No flake.nix upstream yet
|
||||
};
|
||||
|
||||
perles = {
|
||||
url = "github:zjrosen/perles";
|
||||
flake = false; # No flake.nix upstream yet
|
||||
};
|
||||
|
||||
nix-doom-emacs-unstraightened = {
|
||||
url = "github:marienz/nix-doom-emacs-unstraightened";
|
||||
# Don't follow nixpkgs to avoid rebuild issues with emacs-overlay
|
||||
inputs.nixpkgs.follows = "";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... } @ inputs: let
|
||||
baseModules = [
|
||||
./roles
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
];
|
||||
in {
|
||||
nixosConfigurations.z790prors-nix = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = baseModules ++ [
|
||||
./machines/z790prors/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-z790prors.nix;
|
||||
home-manager.extraSpecialArgs.customPkgs =
|
||||
nixpkgs.legacyPackages."${system}".callPackage ./packages {};
|
||||
}
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, ... } @ inputs: let
|
||||
# Shared overlay function to reduce duplication across module sets
|
||||
# Parameters:
|
||||
# unstableOverlays: Additional overlays to apply when importing nixpkgs-unstable
|
||||
mkBaseOverlay = { unstableOverlays ? [] }: (final: prev: {
|
||||
unstable = import nixpkgs-unstable {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
config.allowUnfree = true;
|
||||
overlays = unstableOverlays;
|
||||
};
|
||||
# Separate nixpkgs for qt5webengine-heavy packages to avoid rebuild churn
|
||||
qt-pinned = import inputs.nixpkgs-qt {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
custom = prev.callPackage ./packages {};
|
||||
# Compatibility: bitwarden renamed to bitwarden-desktop in unstable
|
||||
bitwarden-desktop = prev.bitwarden-desktop or prev.bitwarden;
|
||||
});
|
||||
|
||||
# Shared home-manager configuration factory
|
||||
# Parameters:
|
||||
# sharedModules: Additional modules to include in home-manager.sharedModules
|
||||
mkHomeManagerConfig = { sharedModules ? [] }: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.sharedModules = sharedModules ++ [
|
||||
inputs.nix-doom-emacs-unstraightened.homeModule
|
||||
];
|
||||
home-manager.extraSpecialArgs = {
|
||||
globalInputs = inputs;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# Shared unstable overlays for custom package builds
|
||||
customUnstableOverlays = [
|
||||
# Override claude-code in unstable to use our custom GCS-based build
|
||||
# (needed for corporate networks that block npm registry)
|
||||
(ufinal: uprev: {
|
||||
claude-code = uprev.callPackage ./packages/claude-code {};
|
||||
})
|
||||
];
|
||||
|
||||
nixosModules = [
|
||||
./roles
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
nixpkgs.overlays = [ (mkBaseOverlay { unstableOverlays = customUnstableOverlays; }) ];
|
||||
}
|
||||
(mkHomeManagerConfig {
|
||||
sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ];
|
||||
})
|
||||
];
|
||||
|
||||
# Modules for unstable-based systems (like nix-deck)
|
||||
nixosModulesUnstable = [
|
||||
./roles
|
||||
inputs.home-manager-unstable.nixosModules.home-manager
|
||||
inputs.jovian.nixosModules.jovian
|
||||
{
|
||||
nixpkgs.overlays = [ (mkBaseOverlay { unstableOverlays = customUnstableOverlays; }) ];
|
||||
}
|
||||
(mkHomeManagerConfig {
|
||||
sharedModules = [ inputs.plasma-manager-unstable.homeModules.plasma-manager ];
|
||||
})
|
||||
];
|
||||
|
||||
darwinModules = [
|
||||
./roles/darwin.nix
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
{
|
||||
nixpkgs.overlays = [ (mkBaseOverlay { unstableOverlays = customUnstableOverlays; }) ];
|
||||
}
|
||||
(mkHomeManagerConfig { sharedModules = []; })
|
||||
];
|
||||
|
||||
in {
|
||||
nixosConfigurations.nix-book = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
./machines/nix-book/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-nix-book.nix;
|
||||
home-manager.extraSpecialArgs.customPkgs =
|
||||
nixpkgs.legacyPackages."${system}".callPackage ./packages {};
|
||||
home-manager.users.johno = {
|
||||
imports = [ ./home/home-laptop-compact.nix ];
|
||||
# Machine-specific overrides
|
||||
home.roles.i3_sway.extraSwayConfig = {
|
||||
output.eDP-1.scale = "1.75";
|
||||
};
|
||||
};
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixosConfigurations.boxy = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = baseModules ++ [
|
||||
modules = nixosModules ++ [
|
||||
./machines/boxy/configuration.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-default.nix;
|
||||
home-manager.extraSpecialArgs.customPkgs =
|
||||
nixpkgs.legacyPackages."${system}".callPackage ./packages {};
|
||||
home-manager.users.johno = import ./home/home-media-center.nix;
|
||||
home-manager.users.kodi = import ./home/home-kodi.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixosConfigurations.zix790prors = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = nixosModules ++ [
|
||||
./machines/zix790prors/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-desktop.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Live USB ISO configuration
|
||||
nixosConfigurations.live-usb = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = nixosModules ++ [
|
||||
./machines/live-usb/configuration.nix
|
||||
{
|
||||
home-manager.users.nixos = import ./home/home-live-usb.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Steam Deck configuration (using unstable for better Jovian compatibility)
|
||||
nixosConfigurations.nix-deck = nixpkgs-unstable.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = nixosModulesUnstable ++ [
|
||||
./machines/nix-deck/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-desktop.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# ZFS/NFS server configuration
|
||||
nixosConfigurations.john-endesktop = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = nixosModules ++ [
|
||||
./machines/john-endesktop/configuration.nix
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-server.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Darwin/macOS configurations
|
||||
darwinConfigurations."BLKFV4YF49KT7" = inputs.nix-darwin.lib.darwinSystem rec {
|
||||
system = "aarch64-darwin";
|
||||
modules = darwinModules ++ [
|
||||
./machines/johno-macbookpro/configuration.nix
|
||||
{
|
||||
home-manager.users.johno = import ./home/home-darwin-work.nix;
|
||||
home-manager.extraSpecialArgs = { inherit system; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Flake apps
|
||||
apps = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
commonDeps = [ pkgs.curl pkgs.jq pkgs.nix pkgs.git pkgs.gnused pkgs.gnugrep pkgs.coreutils pkgs.gawk ];
|
||||
|
||||
update-doomemacs = pkgs.writeShellScriptBin "update-doomemacs" ''
|
||||
export PATH="${pkgs.lib.makeBinPath commonDeps}:$PATH"
|
||||
${builtins.readFile ./scripts/update-doomemacs.sh}
|
||||
'';
|
||||
|
||||
update-claude-code = pkgs.writeShellScriptBin "update-claude-code" ''
|
||||
export PATH="${pkgs.lib.makeBinPath commonDeps}:$PATH"
|
||||
${builtins.readFile ./packages/claude-code/update.sh}
|
||||
'';
|
||||
|
||||
rotate-wallpaper = pkgs.writeShellScriptBin "rotate-wallpaper" ''
|
||||
export PATH="${pkgs.lib.makeBinPath commonDeps}:$PATH"
|
||||
${builtins.readFile ./scripts/rotate-wallpaper.sh}
|
||||
'';
|
||||
|
||||
upgrade = pkgs.writeShellScriptBin "upgrade" ''
|
||||
export PATH="${pkgs.lib.makeBinPath commonDeps}:$PATH"
|
||||
${builtins.readFile ./scripts/upgrade.sh}
|
||||
'';
|
||||
|
||||
bootstrap = pkgs.writeShellScriptBin "bootstrap" ''
|
||||
export PATH="${pkgs.lib.makeBinPath commonDeps}:$PATH"
|
||||
${builtins.readFile ./scripts/bootstrap.sh}
|
||||
'';
|
||||
|
||||
build-liveusb = pkgs.writeShellScriptBin "build-liveusb" ''
|
||||
export PATH="${pkgs.lib.makeBinPath commonDeps}:$PATH"
|
||||
${builtins.readFile ./scripts/build-liveusb.sh}
|
||||
'';
|
||||
in {
|
||||
update-doomemacs = {
|
||||
type = "app";
|
||||
program = "${update-doomemacs}/bin/update-doomemacs";
|
||||
};
|
||||
update-claude-code = {
|
||||
type = "app";
|
||||
program = "${update-claude-code}/bin/update-claude-code";
|
||||
};
|
||||
rotate-wallpaper = {
|
||||
type = "app";
|
||||
program = "${rotate-wallpaper}/bin/rotate-wallpaper";
|
||||
};
|
||||
upgrade = {
|
||||
type = "app";
|
||||
program = "${upgrade}/bin/upgrade";
|
||||
};
|
||||
bootstrap = {
|
||||
type = "app";
|
||||
program = "${bootstrap}/bin/bootstrap";
|
||||
};
|
||||
build-liveusb = {
|
||||
type = "app";
|
||||
program = "${build-liveusb}/bin/build-liveusb";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
123
home/home-darwin-work.nix
Normal file
@@ -0,0 +1,123 @@
|
||||
{ config, lib, pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for Darwin work laptop
|
||||
# Corporate-friendly setup with essential development tools
|
||||
|
||||
home.username = lib.mkForce "johno";
|
||||
home.homeDirectory = lib.mkForce "/Users/johno";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# System packages
|
||||
home.packages = with pkgs; [
|
||||
google-cloud-sdk
|
||||
];
|
||||
|
||||
# Note: ghostty installed via Homebrew (managed outside of nix)
|
||||
|
||||
# Override Darwin-incompatible settings from base role
|
||||
programs.rbw.settings.pinentry = lib.mkForce pkgs.pinentry_mac;
|
||||
|
||||
# Disable Home Manager from managing shell RC files
|
||||
# topsoil/compost will manage these files instead
|
||||
programs.bash.enable = lib.mkForce false;
|
||||
programs.zsh.enable = lib.mkForce false;
|
||||
|
||||
# Create a local nix integration file that topsoil-managed configs can source
|
||||
home.file.".nix-integration.sh" = {
|
||||
text = ''
|
||||
# Source Home Manager session variables (nix paths, environment, etc.)
|
||||
if [ -e /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh ]; then
|
||||
. /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh
|
||||
fi
|
||||
|
||||
# Setup bash completions from nix profiles
|
||||
if [[ ! -v BASH_COMPLETION_VERSINFO ]] && [ -n "$NIX_PROFILES" ]; then
|
||||
for profile in $NIX_PROFILES; do
|
||||
if [ -f "$profile/etc/profile.d/bash_completion.sh" ]; then
|
||||
. "$profile/etc/profile.d/bash_completion.sh"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# command-not-found handler
|
||||
command_not_found_handle() {
|
||||
local p=/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
|
||||
if [ -n "$NIX_PROFILES" ]; then
|
||||
for profile in $NIX_PROFILES; do
|
||||
if [ -x "$profile/bin/command-not-found" ] && [ -f "$p" ]; then
|
||||
"$profile/bin/command-not-found" "$@"
|
||||
return $?
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "$1: command not found" >&2
|
||||
return 127
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
home.file.".nix-integration.zsh" = {
|
||||
text = ''
|
||||
# Source Home Manager session variables (nix paths, environment, etc.)
|
||||
if [ -e /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh ]; then
|
||||
. /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh
|
||||
fi
|
||||
|
||||
# Setup zsh completions from nix profiles
|
||||
typeset -U path cdpath fpath manpath
|
||||
for profile in ''${(z)NIX_PROFILES}; do
|
||||
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
|
||||
done
|
||||
autoload -U compinit && compinit
|
||||
|
||||
# command-not-found handler
|
||||
command_not_found_handler() {
|
||||
local p=/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
|
||||
if [ -n "$NIX_PROFILES" ]; then
|
||||
for profile in ''${(z)NIX_PROFILES}; do
|
||||
if [ -x "$profile/bin/command-not-found" ] && [ -f "$p" ]; then
|
||||
"$profile/bin/command-not-found" "$@"
|
||||
return $?
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "$1: command not found" >&2
|
||||
return 127
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
# Keep SSH and Git disabled to avoid conflicts with work environment
|
||||
programs.ssh.enable = lib.mkForce false;
|
||||
programs.git.enable = lib.mkForce false;
|
||||
programs.rbw.enable = lib.mkForce false;
|
||||
|
||||
home.shell.enableShellIntegration = true;
|
||||
|
||||
home.roles = {
|
||||
base.enable = true;
|
||||
development = {
|
||||
enable = true;
|
||||
allowArbitraryClaudeCodeModelSelection = true;
|
||||
};
|
||||
tmux.enable = true;
|
||||
emacs.enable = true;
|
||||
aerospace = {
|
||||
enable = true;
|
||||
leader = "cmd";
|
||||
ctrlShortcuts.enable = false;
|
||||
sketchybar.enable = true;
|
||||
# Optional: Add per-machine userSettings overrides
|
||||
# userSettings = {
|
||||
# mode.main.binding."${leader}-custom" = "custom-command";
|
||||
# };
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-darwin
|
||||
];
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
{ pkgs, customPkgs, ... }:
|
||||
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "johno";
|
||||
home.homeDirectory = "/home/johno";
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "24.05"; # Please read the comment before changing.
|
||||
|
||||
# The home.packages option allows you to install Nix packages into your
|
||||
# environment.
|
||||
home.packages = [
|
||||
# # Adds the 'hello' command to your environment. It prints a friendly
|
||||
# # "Hello, world!" when run.
|
||||
# pkgs.hello
|
||||
|
||||
# # It is sometimes useful to fine-tune packages, for example, by applying
|
||||
# # overrides. You can do that directly here, just don't forget the
|
||||
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
|
||||
# # fonts?
|
||||
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
|
||||
|
||||
# # You can also create simple shell scripts directly inside your
|
||||
# # configuration. For example, this adds a command 'my-hello' to your
|
||||
# # environment:
|
||||
# (pkgs.writeShellScriptBin "my-hello" ''
|
||||
# echo "Hello, ${config.home.username}!"
|
||||
# '')
|
||||
|
||||
pkgs.bitwarden
|
||||
pkgs.dunst
|
||||
pkgs.element-desktop
|
||||
pkgs.fd
|
||||
#pkgs.fluffychat # security vulnerability in current version
|
||||
pkgs.gzip
|
||||
pkgs.htop
|
||||
pkgs.jellyfin-media-player
|
||||
pkgs.keepassxc
|
||||
pkgs.killall
|
||||
pkgs.kitty
|
||||
pkgs.less
|
||||
pkgs.moonlight-qt
|
||||
pkgs.ncdu
|
||||
pkgs.pandoc
|
||||
pkgs.pinentry-qt
|
||||
#pkgs.pytest
|
||||
pkgs.shellcheck
|
||||
pkgs.solaar # Logitech management software
|
||||
pkgs.tmux
|
||||
pkgs.waybar
|
||||
pkgs.wofi
|
||||
pkgs.vlc
|
||||
|
||||
customPkgs.nextcloudTalkDesktop
|
||||
];
|
||||
|
||||
# Home Manager is pretty good at managing dotfiles. The primary way to manage
|
||||
# plain files is through 'home.file'.
|
||||
home.file = {
|
||||
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
|
||||
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
|
||||
# # symlink to the Nix store copy.
|
||||
# ".screenrc".source = dotfiles/screenrc;
|
||||
|
||||
# # You can also set the file content immediately.
|
||||
# ".gradle/gradle.properties".text = ''
|
||||
# org.gradle.console=verbose
|
||||
# org.gradle.daemon.idletimeout=3600000
|
||||
# '';
|
||||
|
||||
};
|
||||
|
||||
# Home Manager can also manage your environment variables through
|
||||
# 'home.sessionVariables'. These will be explicitly sourced when using a
|
||||
# shell provided by Home Manager. If you don't want to manage your shell
|
||||
# through Home Manager then you have to manually source 'hm-session-vars.sh'
|
||||
# located at either
|
||||
#
|
||||
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
#
|
||||
# or
|
||||
#
|
||||
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
|
||||
#
|
||||
# or
|
||||
#
|
||||
# /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh
|
||||
#
|
||||
home.sessionVariables = {
|
||||
};
|
||||
|
||||
home.sessionPath = [
|
||||
];
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
imports = [
|
||||
./modules/emacs
|
||||
./modules/lutris
|
||||
./modules/i3+sway
|
||||
];
|
||||
|
||||
programs.bash.enable = true;
|
||||
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
programs.command-not-found.enable = true;
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "John Ogle";
|
||||
userEmail = "john@ogle.fyi";
|
||||
extraConfig = {
|
||||
safe.directory = "/etc/nixos";
|
||||
};
|
||||
};
|
||||
|
||||
programs.gpg.enable = true;
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
defaultCacheTtl = 1800;
|
||||
pinentryPackage = pkgs.pinentry-qt;
|
||||
};
|
||||
|
||||
programs.jq.enable = true;
|
||||
|
||||
programs.k9s.enable = true;
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
||||
programs.rbw = {
|
||||
enable = true;
|
||||
settings = {
|
||||
email = "john@johnogle.info";
|
||||
base_url = "https://bitwarden.johnogle.info";
|
||||
pinentry = pkgs.pinentry-qt;
|
||||
};
|
||||
};
|
||||
|
||||
programs.spotify-player.enable = true;
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
addKeysToAgent = "yes";
|
||||
matchBlocks = {
|
||||
"nucdeb1" = {
|
||||
hostname = "nucdeb1.oglehome";
|
||||
user = "root";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.home-manager.autoUpgrade = {
|
||||
enable = true;
|
||||
frequency = "weekly";
|
||||
};
|
||||
|
||||
services.kdeconnect = {
|
||||
enable = true;
|
||||
indicator = true;
|
||||
package = pkgs.kdePackages.kdeconnect-kde;
|
||||
};
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
tray = {
|
||||
enable = true;
|
||||
command = "syncthingtray --wait";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.enable = true;
|
||||
}
|
||||
38
home/home-desktop.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for full desktop experience
|
||||
home.username = "johno";
|
||||
home.homeDirectory = "/home/johno";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Enable all desktop roles for full-featured experience
|
||||
home.roles = {
|
||||
"3d-printing".enable = true;
|
||||
base.enable = true;
|
||||
gaming.enable = true;
|
||||
desktop.enable = true;
|
||||
emacs.enable = true;
|
||||
email.enable = true;
|
||||
i3_sway.enable = true;
|
||||
office.enable = true;
|
||||
media.enable = true;
|
||||
development.enable = true;
|
||||
communication.enable = true;
|
||||
sync.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
kubectl.enable = true;
|
||||
tmux.enable = true;
|
||||
plasma-manager.enable = true;
|
||||
starship.enable = true;
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
home.sessionVariables = {};
|
||||
home.sessionPath = [];
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-linux
|
||||
];
|
||||
}
|
||||
30
home/home-kodi.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for kodi user on boxy
|
||||
# Focused on media center volume control via Home Assistant
|
||||
|
||||
home.username = "kodi";
|
||||
home.homeDirectory = "/home/kodi";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Enable minimal roles for kodi user
|
||||
home.roles = {
|
||||
base.enable = true;
|
||||
plasma-manager-kodi.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
kdePackages.kconfig
|
||||
];
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
home.sessionVariables = {};
|
||||
home.sessionPath = [];
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-linux
|
||||
];
|
||||
}
|
||||
46
home/home-laptop-compact.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{ config, lib, pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for compact laptop setups
|
||||
# Optimized for space-constrained environments
|
||||
|
||||
home.username = "johno";
|
||||
home.homeDirectory = "/home/johno";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Enable essential roles only (exclude heavy office/media packages)
|
||||
home.roles = {
|
||||
base.enable = true;
|
||||
desktop.enable = true;
|
||||
gaming.enable = true;
|
||||
development.enable = true;
|
||||
communication.enable = true;
|
||||
email.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
media.enable = true;
|
||||
sync.enable = true;
|
||||
kubectl.enable = true;
|
||||
tmux.enable = true;
|
||||
plasma-manager.enable = true;
|
||||
emacs.enable = true;
|
||||
i3_sway.enable = true;
|
||||
starship.enable = true;
|
||||
|
||||
# Launcher wrappers for excluded/optional packages
|
||||
launchers = {
|
||||
enable = true;
|
||||
packages = [
|
||||
"libreoffice"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
home.sessionVariables = {};
|
||||
home.sessionPath = [];
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-linux
|
||||
];
|
||||
}
|
||||
43
home/home-live-usb.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{ pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for live USB environments
|
||||
# Minimal setup without persistent services
|
||||
|
||||
home.username = "nixos";
|
||||
home.homeDirectory = "/home/nixos";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Enable minimal roles only (no sync or kdeconnect for live environment)
|
||||
home.roles = {
|
||||
base.enable = true;
|
||||
desktop.enable = true;
|
||||
tmux.enable = true;
|
||||
plasma-manager.enable = true;
|
||||
emacs = {
|
||||
enable = true;
|
||||
# Use pre-built Doom Emacs - all packages built at nix build time
|
||||
# This means no doom sync is needed after booting the live USB
|
||||
prebuiltDoom = true;
|
||||
};
|
||||
i3_sway.enable = true;
|
||||
starship.enable = true;
|
||||
# development.enable = false; # Not needed for live USB
|
||||
# communication.enable = false; # Not needed for live USB
|
||||
# office.enable = false; # Not needed for live USB
|
||||
# media.enable = false; # Not needed for live USB
|
||||
# sync.enable = false; # No persistent sync on live USB
|
||||
# kdeconnect.enable = false; # No device integration on live USB
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
home.sessionVariables = {};
|
||||
home.sessionPath = [];
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-linux
|
||||
];
|
||||
|
||||
# Live USB specific overrides can go here if needed
|
||||
}
|
||||
39
home/home-media-center.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{ pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for media center setups
|
||||
# Optimized for living room media consumption and gaming
|
||||
|
||||
home.username = "johno";
|
||||
home.homeDirectory = "/home/johno";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Enable media center focused roles
|
||||
home.roles = {
|
||||
base.enable = true;
|
||||
desktop.enable = true;
|
||||
gaming.enable = true;
|
||||
media.enable = true;
|
||||
communication.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
development.enable = true;
|
||||
tmux.enable = true;
|
||||
plasma-manager.enable = true;
|
||||
emacs.enable = true;
|
||||
i3_sway.enable = true;
|
||||
starship.enable = true;
|
||||
# office.enable = false; # Not needed for media center
|
||||
# sync.enable = false; # Shared machine, no personal file sync
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
home.sessionVariables = {};
|
||||
home.sessionPath = [];
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-linux
|
||||
];
|
||||
|
||||
# Media center specific overrides can go here if needed
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./home-default.nix
|
||||
./modules/hyprland/nix-book.nix
|
||||
];
|
||||
|
||||
home.i3_sway.extraSwayConfig = {
|
||||
output.eDP-1.scale = "1.75";
|
||||
};
|
||||
}
|
||||
27
home/home-server.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ pkgs, globalInputs, system, ... }:
|
||||
|
||||
{
|
||||
# Home Manager configuration for servers (minimal with development tools)
|
||||
home.username = "johno";
|
||||
home.homeDirectory = "/home/johno";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Minimal roles for server with development capability
|
||||
home.roles = {
|
||||
base.enable = true;
|
||||
development.enable = true;
|
||||
emacs.enable = true;
|
||||
kubectl.enable = true;
|
||||
starship.enable = true;
|
||||
tmux.enable = true;
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
home.sessionVariables = {};
|
||||
home.sessionPath = [];
|
||||
|
||||
imports = [
|
||||
./roles
|
||||
./roles/base-linux
|
||||
];
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./home-default.nix
|
||||
./modules/hyprland/z790prors.nix
|
||||
];
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
doomSync = (let
|
||||
git = pkgs.git;
|
||||
in ''
|
||||
export PATH=${pkgs.emacs}/bin:${git}/bin:$PATH
|
||||
${config.xdg.configHome}/emacs/bin/doom sync -u -j $((`nproc`/4*3))
|
||||
'');
|
||||
in {
|
||||
config = {
|
||||
home.packages = [
|
||||
pkgs.emacs-all-the-icons-fonts
|
||||
pkgs.fontconfig
|
||||
pkgs.graphviz
|
||||
pkgs.isort
|
||||
pkgs.nerdfonts
|
||||
pkgs.nil # nix lsp language server
|
||||
pkgs.nixfmt-rfc-style
|
||||
(pkgs.ripgrep.override {withPCRE2 = true;})
|
||||
pkgs.pipenv
|
||||
pkgs.poetry
|
||||
pkgs.python3
|
||||
];
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
home.file = {
|
||||
".config/emacs" = {
|
||||
source = fetchGit {
|
||||
url = "https://github.com/doomemacs/doomemacs.git";
|
||||
# When updating me, remember to run `doom sync`
|
||||
rev = "5ad99220b86ae1bf421861dfad24492d768ac4d9";
|
||||
};
|
||||
# We need to use recursive mode here or else doom fails to sync for
|
||||
# some reason related to the permissions on the synced path. I'm not
|
||||
# quite sure of everything that's going on here.
|
||||
recursive = true;
|
||||
|
||||
# Because `recursive = true` will cause this to sync every single
|
||||
# activation, we turn this off here.
|
||||
#
|
||||
# There's probably a way we could do better detection of this within
|
||||
# our onChange shell?
|
||||
#
|
||||
# onChange = doomSync;
|
||||
};
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
DOOMLOCALDIR = "${config.xdg.dataHome}/doom";
|
||||
EDITOR = "emacs -nw";
|
||||
};
|
||||
|
||||
home.sessionPath = [
|
||||
"${config.xdg.configHome}/emacs/bin"
|
||||
];
|
||||
|
||||
xdg.configFile."doom" = {
|
||||
source = ./doom;
|
||||
# Sync doom if we updated the config
|
||||
onChange = doomSync;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
;; sync' after modifying this file!
|
||||
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets. It is optional.
|
||||
;; (setq user-full-name "John Doe"
|
||||
;; user-mail-address "john@doe.com")
|
||||
|
||||
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
||||
;;
|
||||
;; - `doom-font' -- the primary font to use
|
||||
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
||||
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
||||
;; presentations or streaming.
|
||||
;; - `doom-symbol-font' -- for symbols
|
||||
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
||||
;;
|
||||
;; See 'C-h v doom-font' for documentation and more examples of what they
|
||||
;; accept. For example:
|
||||
;;
|
||||
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
|
||||
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
|
||||
;;
|
||||
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
||||
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
||||
;; refresh your font settings. If Emacs still can't find your font, it likely
|
||||
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
||||
|
||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
||||
;; `load-theme' function. This is the default:
|
||||
(setq doom-theme 'doom-one)
|
||||
|
||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||
(setq display-line-numbers-type t)
|
||||
|
||||
;; If you use `org' and don't want your org files in the default location below,
|
||||
;; change `org-directory'. It must be set before org loads!
|
||||
(setq org-directory "~/org/")
|
||||
(after! org
|
||||
(setq org-agenda-span 'week
|
||||
org-agenda-files `(,org-directory ,(concat org-directory "roam/"))
|
||||
org-log-done 'time
|
||||
org-agenda-custom-commands '(("n" "Agenda"
|
||||
((agenda "")
|
||||
(tags-todo "-someday-recurring")))
|
||||
("s" "Someday Items"
|
||||
((tags-todo "+someday"))))
|
||||
org-todo-keywords '((sequence "TODO(t)" "IN-PROGRESS(p)" "WAIT(w)" "|" "DONE(d)" "KILL(k)"))
|
||||
org-journal-file-type 'weekly
|
||||
org-journal-file-format "%Y-%m-%d.org"
|
||||
org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "~/org/todo.org" "Inbox")
|
||||
"* TODO %? \n %i \n%a" :prepend t))))
|
||||
|
||||
;; (use-package! org-caldav
|
||||
;; :defer t
|
||||
;; :config
|
||||
;; (setq org-caldav-url "https://nextcloud.johnogle.info/remote.php/dav/calendars/johno"
|
||||
;; org-caldav-calendar-id "personal"
|
||||
;; org-icalendar-timezone "America/Los_Angeles"
|
||||
;; org-caldav-inbox "~/org/calendar.org"
|
||||
;; org-caldav-files nil
|
||||
;; org-caldav-sync-direction 'cal->org))
|
||||
|
||||
|
||||
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
||||
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
||||
;;
|
||||
;; (after! PACKAGE
|
||||
;; (setq x y))
|
||||
;;
|
||||
;; The exceptions to this rule:
|
||||
;;
|
||||
;; - Setting file/directory variables (like `org-directory')
|
||||
;; - Setting variables which explicitly tell you to set them before their
|
||||
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
|
||||
;; - Setting doom variables (which start with 'doom-' or '+').
|
||||
;;
|
||||
;; Here are some additional functions/macros that will help you configure Doom.
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
;; - `use-package!' for configuring packages
|
||||
;; - `after!' for running code after a package has loaded
|
||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
||||
;; this file. Emacs searches the `load-path' when you load packages with
|
||||
;; `require' or `use-package'.
|
||||
;; - `map!' for binding new keys
|
||||
;;
|
||||
;; To get information about any of these functions/macros, move the cursor over
|
||||
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
||||
;; This will open documentation for it, including demos of how they are used.
|
||||
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
||||
;; etc).
|
||||
;;
|
||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
@@ -1,94 +0,0 @@
|
||||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hyprpaper.nix
|
||||
];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
plugins = [ inputs.hy3.packages.x86_64-linux.hy3 ];
|
||||
settings = {
|
||||
"$mod" = "SUPER";
|
||||
"$terminal" = "kitty";
|
||||
"$fileManager" = "dolphin";
|
||||
"$menu" = "wofi --show drun";
|
||||
|
||||
exec-once = [
|
||||
"waybar"
|
||||
"dunst"
|
||||
];
|
||||
|
||||
xwayland = {
|
||||
force_zero_scaling = true;
|
||||
};
|
||||
|
||||
input = {
|
||||
kb_layout = "us";
|
||||
kb_options = "caps:escape";
|
||||
follow_mouse = 1;
|
||||
touchpad.natural_scroll = false;
|
||||
};
|
||||
|
||||
windowrulev2 = [
|
||||
# I can guess, but I should figure out what this actually does
|
||||
"suppressevent maximize, class:.*"
|
||||
];
|
||||
|
||||
general.layout = "hy3";
|
||||
|
||||
bind =
|
||||
[
|
||||
"SHIFT_$mod, Q, killactive"
|
||||
"SHIFT_$mod, M, exit"
|
||||
|
||||
"$mod, D, exec, $menu"
|
||||
"$mod, Return, exec, $terminal"
|
||||
|
||||
"$mod, H, hy3:movefocus, l"
|
||||
"$mod, L, hy3:movefocus, r"
|
||||
"$mod, K, hy3:movefocus, u"
|
||||
"$mod, J, hy3:movefocus, d"
|
||||
|
||||
"SHIFT_$mod, H, hy3:movewindow, l"
|
||||
"SHIFT_$mod, L, hy3:movewindow, r"
|
||||
"SHIFT_$mod, K, hy3:movewindow, u"
|
||||
"SHIFT_$mod, J, hy3:movewindow, d"
|
||||
|
||||
"$mod, V, hy3:makegroup, opposite"
|
||||
"$mod, W, hy3:changegroup, toggletab"
|
||||
|
||||
"$mod, A, hy3:changefocus, raise"
|
||||
"SHIFT_$mod, A, hy3:changefocus, lower"
|
||||
|
||||
"$mod, M, fullscreen, 0"
|
||||
"$mod, E, hy3:expand, expand"
|
||||
"SHIFT_$mod, E, hy3:expand, base"
|
||||
|
||||
"$mod, Q, hy3:warpcursor"
|
||||
]
|
||||
++ (
|
||||
# workspaces
|
||||
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
|
||||
builtins.concatLists (builtins.genList (
|
||||
x: let
|
||||
ws = let
|
||||
c = (x + 1) / 10;
|
||||
in
|
||||
builtins.toString (x + 1 - (c * 10));
|
||||
in [
|
||||
"$mod, ${ws}, workspace, ${toString (x + 1)}"
|
||||
"$mod SHIFT, ${ws}, hy3:movetoworkspace, ${toString (x + 1)}"
|
||||
]
|
||||
)
|
||||
10)
|
||||
);
|
||||
|
||||
bindm =
|
||||
[
|
||||
"$mod, mouse:272, movewindow"
|
||||
"$mod, mouse:273, resizewindow"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.hyprpaper = {
|
||||
enable = true;
|
||||
settings = {
|
||||
ipc = "on";
|
||||
splash = false;
|
||||
preload = [
|
||||
"${config.xdg.dataHome}/wallpaper.jpg"
|
||||
];
|
||||
wallpaper = [
|
||||
",${config.xdg.dataHome}/wallpaper.jpg"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
xdg.dataFile."wallpaper.jpg" = {
|
||||
source = ./wallpaper.jpg;
|
||||
};
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
wayland.windowManager.hyprland.settings.monitor = ",preferred,2880x1800@90.00Hz,1.33333";
|
||||
}
|
||||
|
Before Width: | Height: | Size: 842 KiB |
@@ -1,16 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
wayland.windowManager.hyprland.settings.monitor = "DP-1,3440x1440@164.90,0x0,1.33333,vrr,1";
|
||||
wayland.windowManager.hyprland.settings.env = [
|
||||
"LIBVA_DRIVER_NAME,nvidia"
|
||||
"XDG_SESSION_TYPE,wayland"
|
||||
"GBM_BACKEND,nvidia-drm"
|
||||
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
|
||||
"NVD_BACKEND,direct"
|
||||
"ELECTRON_OZONE_PLATFORM_HINT,auto"
|
||||
"NIXOS_OZONE_WL,1"
|
||||
];
|
||||
|
||||
wayland.windowManager.hyprland.settings.cursor.no_hardware_cursors = true;
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.i3_sway;
|
||||
i3_cfg = config.xsession.windowManager.i3.config;
|
||||
|
||||
shared_config = recursiveUpdate rec {
|
||||
modifier = "Mod4";
|
||||
terminal = "kitty";
|
||||
defaultWorkspace = "workspace number 1";
|
||||
|
||||
keybindings = {
|
||||
"${shared_config.modifier}+Return" = "exec ${terminal}";
|
||||
"${shared_config.modifier}+Shift+q" = "kill";
|
||||
"${shared_config.modifier}+d" = "exec ${i3_cfg.menu}";
|
||||
|
||||
"${shared_config.modifier}+h" = "focus left";
|
||||
"${shared_config.modifier}+j" = "focus down";
|
||||
"${shared_config.modifier}+k" = "focus up";
|
||||
"${shared_config.modifier}+l" = "focus right";
|
||||
|
||||
"${shared_config.modifier}+Shift+h" = "move left";
|
||||
"${shared_config.modifier}+Shift+j" = "move down";
|
||||
"${shared_config.modifier}+Shift+k" = "move up";
|
||||
"${shared_config.modifier}+Shift+l" = "move right";
|
||||
|
||||
"${shared_config.modifier}+Left" = "focus left";
|
||||
"${shared_config.modifier}+Down" = "focus down";
|
||||
"${shared_config.modifier}+Up" = "focus up";
|
||||
"${shared_config.modifier}+Right" = "focus right";
|
||||
|
||||
"${shared_config.modifier}+Shift+Left" = "move left";
|
||||
"${shared_config.modifier}+Shift+Down" = "move down";
|
||||
"${shared_config.modifier}+Shift+Up" = "move up";
|
||||
"${shared_config.modifier}+Shift+Right" = "move right";
|
||||
|
||||
#"${shared_config.modifier}+h" = "split h";
|
||||
"${shared_config.modifier}+v" = "split v";
|
||||
"${shared_config.modifier}+f" = "fullscreen toggle";
|
||||
|
||||
"${shared_config.modifier}+s" = "layout stacking";
|
||||
"${shared_config.modifier}+w" = "layout tabbed";
|
||||
"${shared_config.modifier}+e" = "layout toggle split";
|
||||
|
||||
"${shared_config.modifier}+Shift+space" = "floating toggle";
|
||||
"${shared_config.modifier}+space" = "focus mode_toggle";
|
||||
|
||||
"${shared_config.modifier}+a" = "focus parent";
|
||||
|
||||
"${shared_config.modifier}+Shift+minus" = "move scratchpad";
|
||||
"${shared_config.modifier}+minus" = "scratchpad show";
|
||||
|
||||
"${shared_config.modifier}+1" = "workspace number 1";
|
||||
"${shared_config.modifier}+2" = "workspace number 2";
|
||||
"${shared_config.modifier}+3" = "workspace number 3";
|
||||
"${shared_config.modifier}+4" = "workspace number 4";
|
||||
"${shared_config.modifier}+5" = "workspace number 5";
|
||||
"${shared_config.modifier}+6" = "workspace number 6";
|
||||
"${shared_config.modifier}+7" = "workspace number 7";
|
||||
"${shared_config.modifier}+8" = "workspace number 8";
|
||||
"${shared_config.modifier}+9" = "workspace number 9";
|
||||
"${shared_config.modifier}+0" = "workspace number 10";
|
||||
|
||||
"${shared_config.modifier}+Shift+1" =
|
||||
"move container to workspace number 1";
|
||||
"${shared_config.modifier}+Shift+2" =
|
||||
"move container to workspace number 2";
|
||||
"${shared_config.modifier}+Shift+3" =
|
||||
"move container to workspace number 3";
|
||||
"${shared_config.modifier}+Shift+4" =
|
||||
"move container to workspace number 4";
|
||||
"${shared_config.modifier}+Shift+5" =
|
||||
"move container to workspace number 5";
|
||||
"${shared_config.modifier}+Shift+6" =
|
||||
"move container to workspace number 6";
|
||||
"${shared_config.modifier}+Shift+7" =
|
||||
"move container to workspace number 7";
|
||||
"${shared_config.modifier}+Shift+8" =
|
||||
"move container to workspace number 8";
|
||||
"${shared_config.modifier}+Shift+9" =
|
||||
"move container to workspace number 9";
|
||||
"${shared_config.modifier}+Shift+0" =
|
||||
"move container to workspace number 10";
|
||||
|
||||
"${shared_config.modifier}+Shift+c" = "reload";
|
||||
"${shared_config.modifier}+Shift+r" = "restart";
|
||||
|
||||
"${shared_config.modifier}+r" = "mode resize";
|
||||
|
||||
"XF86MonBrightnessUp" = "exec brightnessctl s +5%";
|
||||
"XF86MonBrightnessDown" = "exec brightnessctl s 5%-";
|
||||
};
|
||||
} cfg.extraSharedConfig;
|
||||
in {
|
||||
options.home.i3_sway = {
|
||||
extraSharedConfig = mkOption {
|
||||
default = {};
|
||||
};
|
||||
extraI3Config = mkOption {
|
||||
default = {};
|
||||
};
|
||||
extraSwayConfig = mkOption {
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
xsession.windowManager.i3 = let
|
||||
base_i3_config = recursiveUpdate shared_config {
|
||||
keybindings = {
|
||||
"${shared_config.modifier}+Shift+e" =
|
||||
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
|
||||
};
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
config = recursiveUpdate base_i3_config cfg.extraI3Config;
|
||||
};
|
||||
|
||||
wayland.windowManager.sway = let
|
||||
base_sway_config = recursiveUpdate shared_config {
|
||||
keybindings = {
|
||||
"${shared_config.modifier}+Shift+e" =
|
||||
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
||||
};
|
||||
input = {
|
||||
"type:keyboard" = {
|
||||
xkb_options = "caps:escape";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
config = recursiveUpdate base_sway_config cfg.extraSwayConfig;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.gamescope
|
||||
pkgs.lutris
|
||||
pkgs.mangohud
|
||||
];
|
||||
}
|
||||
22
home/roles/3d-printing/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles."3d-printing";
|
||||
in
|
||||
{
|
||||
options.home.roles."3d-printing" = {
|
||||
enable = mkEnableOption "Enable 3D printing applications and tools";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
# 3D Slicing Software
|
||||
orca-slicer # G-code generator for 3D printers (Bambu, Prusa, Voron, etc.)
|
||||
|
||||
# 3D Modeling Software
|
||||
openscad-unstable # 3D parametric model compiler (nightly build)
|
||||
];
|
||||
};
|
||||
}
|
||||
729
home/roles/aerospace/default.nix
Normal file
@@ -0,0 +1,729 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.aerospace;
|
||||
in
|
||||
{
|
||||
options.home.roles.aerospace = {
|
||||
enable = mkEnableOption "AeroSpace tiling window manager for macOS";
|
||||
|
||||
leader = mkOption {
|
||||
type = types.str;
|
||||
default = "cmd";
|
||||
description = "Leader key for aerospace shortcuts (e.g., 'cmd', 'ctrl', 'alt')";
|
||||
example = "ctrl";
|
||||
};
|
||||
|
||||
launchd.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable launchd agent for auto-starting aerospace";
|
||||
};
|
||||
|
||||
userSettings = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Additional aerospace configuration settings to merge with defaults.
|
||||
Use this to override or extend the default configuration on a per-machine basis.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
mode.main.binding."''${leader}-custom" = "custom-command";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
autoraise = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable autoraise (auto-focus window on hover)";
|
||||
};
|
||||
|
||||
pollMillis = mkOption {
|
||||
type = types.int;
|
||||
default = 50;
|
||||
description = "Polling interval in milliseconds";
|
||||
};
|
||||
|
||||
delay = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Delay before raising window";
|
||||
};
|
||||
|
||||
focusDelay = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Delay before focusing window";
|
||||
};
|
||||
};
|
||||
|
||||
enableSpansDisplays = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Configure macOS Spaces to span displays (required for aerospace multi-monitor support).
|
||||
Sets com.apple.spaces.spans-displays to true.
|
||||
|
||||
NOTE: This was previously set at the system level in modules/aerospace.nix,
|
||||
but has been moved to home-manager for better modularity.
|
||||
'';
|
||||
};
|
||||
|
||||
ctrlShortcuts = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Remap common macOS Cmd shortcuts to Ctrl equivalents for all operations.
|
||||
This makes macOS behave more like Linux.
|
||||
|
||||
Shortcuts remapped globally:
|
||||
- Ctrl+N: New Window
|
||||
- Ctrl+T: New Tab
|
||||
- Ctrl+W: Close Tab
|
||||
- Ctrl+S: Save / Save As
|
||||
- Ctrl+O: Open
|
||||
- Ctrl+F: Find
|
||||
- Ctrl+H: Find and Replace
|
||||
- Ctrl+P: Print
|
||||
- Ctrl+C/V/X: Copy/Paste/Cut
|
||||
- Ctrl+Z: Undo
|
||||
|
||||
NOTE: Terminal emulators like Ghostty require per-app overrides (configured separately)
|
||||
to preserve Ctrl+C as SIGINT instead of Copy.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
sketchybar = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable SketchyBar status bar";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Only apply on Darwin systems
|
||||
assertions = [
|
||||
{
|
||||
assertion = pkgs.stdenv.isDarwin;
|
||||
message = "Aerospace role is only supported on macOS (Darwin) systems";
|
||||
}
|
||||
];
|
||||
|
||||
# Configure macOS preferences via targets.darwin.defaults
|
||||
targets.darwin.defaults = mkMerge [
|
||||
# Spaces span displays (required for multi-monitor aerospace)
|
||||
(mkIf cfg.enableSpansDisplays {
|
||||
"com.apple.spaces" = {
|
||||
spans-displays = true;
|
||||
};
|
||||
})
|
||||
|
||||
# Ctrl shortcuts to make macOS behave more like Linux
|
||||
(mkIf cfg.ctrlShortcuts.enable {
|
||||
NSGlobalDomain.NSUserKeyEquivalents = {
|
||||
# Window/Tab operations
|
||||
"New Window" = "^n";
|
||||
"New Tab" = "^t";
|
||||
"Close Tab" = "^w";
|
||||
# File operations
|
||||
"Save" = "^s";
|
||||
"Save As…" = "^$s"; # Ctrl+Shift+S
|
||||
"Open" = "^o";
|
||||
"Open…" = "^o";
|
||||
# Find operations
|
||||
"Find" = "^f";
|
||||
"Find…" = "^f";
|
||||
"Find and Replace" = "^h";
|
||||
"Find and Replace…" = "^h";
|
||||
# Print
|
||||
"Print" = "^p";
|
||||
"Print…" = "^p";
|
||||
# Clipboard operations
|
||||
"Copy" = "^c";
|
||||
"Paste" = "^v";
|
||||
"Cut" = "^x";
|
||||
# Undo/Redo
|
||||
"Undo" = "^z";
|
||||
"Redo" = "^$z"; # Ctrl+Shift+Z
|
||||
};
|
||||
})
|
||||
|
||||
# Ghostty-specific overrides to preserve terminal behavior
|
||||
# Remap clipboard operations back to Cmd (macOS default) so Ctrl+C remains SIGINT
|
||||
(mkIf cfg.ctrlShortcuts.enable {
|
||||
"com.mitchellh.ghostty".NSUserKeyEquivalents = {
|
||||
# Remap back to Cmd for clipboard operations
|
||||
"Copy" = "@c"; # Cmd+C
|
||||
"Paste" = "@v"; # Cmd+V
|
||||
"Cut" = "@x"; # Cmd+X
|
||||
"Undo" = "@z"; # Cmd+Z
|
||||
"Redo" = "@$z"; # Cmd+Shift+Z
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
# Install aerospace package and optional tools if enabled
|
||||
home.packages = [ pkgs.aerospace ]
|
||||
++ optionals cfg.autoraise.enable [ pkgs.autoraise ]
|
||||
++ optionals cfg.sketchybar.enable [ pkgs.sketchybar pkgs.sketchybar-app-font ];
|
||||
|
||||
# Enable and configure aerospace
|
||||
programs.aerospace.enable = true;
|
||||
programs.aerospace.launchd.enable = cfg.launchd.enable;
|
||||
programs.aerospace.userSettings = mkMerge [
|
||||
# Default configuration with leader key substitution
|
||||
{
|
||||
# Disable normalizations for i3-like behavior
|
||||
enable-normalization-flatten-containers = false;
|
||||
enable-normalization-opposite-orientation-for-nested-containers = false;
|
||||
|
||||
mode.main.binding = {
|
||||
"${cfg.leader}-w" = "layout accordion horizontal"; # tabbed
|
||||
"${cfg.leader}-s" = "layout accordion vertical"; # stacking
|
||||
"${cfg.leader}-e" = "layout tiles horizontal vertical"; # tiles, toggles orientation
|
||||
"${cfg.leader}-shift-q" = "close";
|
||||
"${cfg.leader}-shift-f" = "fullscreen";
|
||||
"${cfg.leader}-h" = "focus left";
|
||||
"${cfg.leader}-j" = "focus down";
|
||||
"${cfg.leader}-k" = "focus up";
|
||||
"${cfg.leader}-l" = "focus right";
|
||||
"${cfg.leader}-shift-h" = "move left";
|
||||
"${cfg.leader}-shift-j" = "move down";
|
||||
"${cfg.leader}-shift-k" = "move up";
|
||||
"${cfg.leader}-shift-l" = "move right";
|
||||
"${cfg.leader}-r" = "mode resize";
|
||||
"${cfg.leader}-1" = "workspace 1";
|
||||
"${cfg.leader}-2" = "workspace 2";
|
||||
"${cfg.leader}-3" = "workspace 3";
|
||||
"${cfg.leader}-4" = "workspace 4";
|
||||
"${cfg.leader}-5" = "workspace 5";
|
||||
"${cfg.leader}-6" = "workspace 6";
|
||||
"${cfg.leader}-7" = "workspace 7";
|
||||
"${cfg.leader}-8" = "workspace 8";
|
||||
"${cfg.leader}-9" = "workspace 9";
|
||||
"${cfg.leader}-0" = "workspace 10";
|
||||
"${cfg.leader}-shift-1" = "move-node-to-workspace 1";
|
||||
"${cfg.leader}-shift-2" = "move-node-to-workspace 2";
|
||||
"${cfg.leader}-shift-3" = "move-node-to-workspace 3";
|
||||
"${cfg.leader}-shift-4" = "move-node-to-workspace 4";
|
||||
"${cfg.leader}-shift-5" = "move-node-to-workspace 5";
|
||||
"${cfg.leader}-shift-6" = "move-node-to-workspace 6";
|
||||
"${cfg.leader}-shift-7" = "move-node-to-workspace 7";
|
||||
"${cfg.leader}-shift-8" = "move-node-to-workspace 8";
|
||||
"${cfg.leader}-shift-9" = "move-node-to-workspace 9";
|
||||
"${cfg.leader}-shift-0" = "move-node-to-workspace 10";
|
||||
"${cfg.leader}-tab" = "workspace-back-and-forth";
|
||||
"${cfg.leader}-shift-tab" = "move-workspace-to-monitor --wrap-around next";
|
||||
|
||||
"${cfg.leader}-enter" = ''
|
||||
exec-and-forget osascript <<'APPLESCRIPT'
|
||||
tell application "Ghostty"
|
||||
activate
|
||||
tell application "System Events"
|
||||
keystroke "n" using {command down}
|
||||
end tell
|
||||
end tell
|
||||
APPLESCRIPT
|
||||
'';
|
||||
|
||||
"${cfg.leader}-shift-enter" = ''
|
||||
exec-and-forget osascript <<'APPLESCRIPT'
|
||||
tell application "Google Chrome"
|
||||
set newWindow to make new window
|
||||
activate
|
||||
tell newWindow to set index to 1
|
||||
end tell
|
||||
APPLESCRIPT
|
||||
'';
|
||||
|
||||
"${cfg.leader}-shift-e" = "exec-and-forget zsh --login -c \"emacsclient -c -n\"";
|
||||
|
||||
# Service mode: Deliberate aerospace window management
|
||||
"${cfg.leader}-i" = "mode service";
|
||||
|
||||
# Passthrough mode: Temporarily disable aerospace to use macOS shortcuts
|
||||
"${cfg.leader}-p" = "mode passthrough";
|
||||
};
|
||||
|
||||
# Resize mode: For window resizing operations
|
||||
mode.resize.binding = {
|
||||
h = "resize width -50";
|
||||
j = "resize height +50";
|
||||
k = "resize height -50";
|
||||
l = "resize width +50";
|
||||
|
||||
minus = "resize smart -50";
|
||||
equal = "resize smart +50";
|
||||
|
||||
esc = "mode main";
|
||||
enter = "mode main";
|
||||
};
|
||||
|
||||
# Service mode: For deliberate aerospace window management operations
|
||||
mode.service.binding = {
|
||||
esc = ["reload-config" "mode main"];
|
||||
r = ["flatten-workspace-tree" "mode main"]; # reset layout
|
||||
f = ["layout floating tiling" "mode main"]; # Toggle between floating and tiling layout
|
||||
backspace = ["close-all-windows-but-current" "mode main"];
|
||||
|
||||
"${cfg.leader}-shift-h" = ["join-with left" "mode main"];
|
||||
"${cfg.leader}-shift-j" = ["join-with down" "mode main"];
|
||||
"${cfg.leader}-shift-k" = ["join-with up" "mode main"];
|
||||
"${cfg.leader}-shift-l" = ["join-with right" "mode main"];
|
||||
};
|
||||
|
||||
# Passthrough mode: All shortcuts pass through to macOS
|
||||
mode.passthrough.binding = {
|
||||
esc = "mode main";
|
||||
"${cfg.leader}-p" = "mode main";
|
||||
};
|
||||
|
||||
# SketchyBar integration - notify bar of workspace changes
|
||||
exec-on-workspace-change = mkIf cfg.sketchybar.enable [
|
||||
"/bin/bash" "-c"
|
||||
"${pkgs.sketchybar}/bin/sketchybar --trigger aerospace_workspace_change FOCUSED=$AEROSPACE_FOCUSED_WORKSPACE PREV=$AEROSPACE_PREV_WORKSPACE"
|
||||
];
|
||||
}
|
||||
# Gaps configuration - prevent windows from overlapping SketchyBar
|
||||
(mkIf cfg.sketchybar.enable {
|
||||
gaps = {
|
||||
outer = {
|
||||
top = 0;
|
||||
bottom = 38;
|
||||
left = 0;
|
||||
right = 0;
|
||||
};
|
||||
};
|
||||
})
|
||||
cfg.userSettings
|
||||
];
|
||||
|
||||
# Launchd agent for autoraise
|
||||
launchd.agents.autoraise = mkIf cfg.autoraise.enable {
|
||||
enable = true;
|
||||
config = {
|
||||
ProgramArguments = [
|
||||
"${pkgs.autoraise}/bin/AutoRaise"
|
||||
"-pollMillis" (toString cfg.autoraise.pollMillis)
|
||||
"-delay" (toString cfg.autoraise.delay)
|
||||
"-focusDelay" (toString cfg.autoraise.focusDelay)
|
||||
];
|
||||
RunAtLoad = true;
|
||||
KeepAlive = true;
|
||||
};
|
||||
};
|
||||
|
||||
# SketchyBar configuration
|
||||
home.file.".config/sketchybar/sketchybarrc" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
onChange = "${pkgs.sketchybar}/bin/sketchybar --reload";
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
# Plugin directory
|
||||
PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
|
||||
|
||||
# Colors - i3/sway theme with exact color matching
|
||||
# Focused window/workspace color from i3/sway
|
||||
FOCUSED=0xff285577
|
||||
|
||||
# Background colors matching i3blocks bar
|
||||
BAR_BG=0xff333333 # Dark gray
|
||||
ITEM_BG=0xff333333 # Dark gray matching bar
|
||||
|
||||
# Text colors
|
||||
TEXT=0xffffffff # White text
|
||||
GRAY=0xff888888 # Muted text for inactive items
|
||||
|
||||
# Accent colors for warnings
|
||||
WARNING=0xffff9900
|
||||
CRITICAL=0xff900000
|
||||
|
||||
# Configure the bar appearance
|
||||
${pkgs.sketchybar}/bin/sketchybar --bar \
|
||||
position=bottom \
|
||||
height=30 \
|
||||
color=$BAR_BG \
|
||||
border_width=0 \
|
||||
corner_radius=0 \
|
||||
padding_left=10 \
|
||||
padding_right=10 \
|
||||
shadow=off \
|
||||
topmost=on \
|
||||
sticky=on
|
||||
|
||||
# Set default properties for all items
|
||||
# Using monospace font to match waybar's Fira Code styling
|
||||
${pkgs.sketchybar}/bin/sketchybar --default \
|
||||
updates=when_shown \
|
||||
icon.font="Fira Code:Regular:13.0" \
|
||||
icon.color=$TEXT \
|
||||
icon.padding_left=4 \
|
||||
icon.padding_right=4 \
|
||||
label.font="Fira Code:Regular:13.0" \
|
||||
label.color=$TEXT \
|
||||
label.padding_left=4 \
|
||||
label.padding_right=4 \
|
||||
padding_left=4 \
|
||||
padding_right=4 \
|
||||
background.corner_radius=0 \
|
||||
background.height=30
|
||||
|
||||
# Register aerospace workspace change event
|
||||
${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change
|
||||
|
||||
# Create workspace indicators for workspaces 1-10
|
||||
for sid in 1 2 3 4 5 6 7 8 9 10; do
|
||||
# Display "0" for workspace 10
|
||||
if [ "$sid" = "10" ]; then
|
||||
display="0"
|
||||
else
|
||||
display="$sid"
|
||||
fi
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \
|
||||
--subscribe space.$sid aerospace_workspace_change \
|
||||
--set space.$sid \
|
||||
drawing=on \
|
||||
update_freq=2 \
|
||||
width=32 \
|
||||
background.color=$ITEM_BG \
|
||||
background.corner_radius=0 \
|
||||
background.height=30 \
|
||||
background.drawing=on \
|
||||
icon="$display" \
|
||||
icon.padding_left=13 \
|
||||
icon.padding_right=11 \
|
||||
icon.align=center \
|
||||
label.drawing=off \
|
||||
click_script="${pkgs.aerospace}/bin/aerospace workspace $sid" \
|
||||
script="$PLUGIN_DIR/aerospace.sh $sid"
|
||||
done
|
||||
|
||||
# System monitoring modules (right side)
|
||||
# Note: Items added to 'right' appear in reverse order (last added = leftmost)
|
||||
# Adding in reverse to get: disk | cpu | memory | battery | volume | calendar
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item calendar right \
|
||||
--set calendar \
|
||||
icon="📅" \
|
||||
update_freq=30 \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/calendar.sh"
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item volume right \
|
||||
--set volume \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/volume.sh" \
|
||||
--subscribe volume volume_change
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item battery right \
|
||||
--set battery \
|
||||
update_freq=120 \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/battery.sh" \
|
||||
--subscribe battery system_woke power_source_change
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item memory right \
|
||||
--set memory \
|
||||
update_freq=5 \
|
||||
icon="🐏" \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/memory.sh"
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item cpu right \
|
||||
--set cpu \
|
||||
update_freq=2 \
|
||||
icon="🧠" \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/cpu.sh"
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --add item disk right \
|
||||
--set disk \
|
||||
update_freq=60 \
|
||||
icon="💾" \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
script="$PLUGIN_DIR/disk.sh"
|
||||
|
||||
# Menu bar extras / system tray items (rightmost)
|
||||
# Note: Requires Screen Recording permission for SketchyBar in System Settings
|
||||
# Use 'sketchybar --query default_menu_items' to discover available items
|
||||
|
||||
# Bluetooth
|
||||
${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Bluetooth" right \
|
||||
--set "Control Center,Bluetooth" \
|
||||
alias.update_freq=1 \
|
||||
padding_left=0 \
|
||||
padding_right=0
|
||||
|
||||
# WiFi
|
||||
${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,WiFi" right \
|
||||
--set "Control Center,WiFi" \
|
||||
alias.update_freq=1 \
|
||||
padding_left=0 \
|
||||
padding_right=0
|
||||
|
||||
# Add other menu bar apps as discovered
|
||||
# Common examples:
|
||||
# - Cloudflare WARP: --add alias "Cloudflare WARP,Item-0" right
|
||||
# - Notion Calendar: --add alias "Notion Calendar,Item-0" right
|
||||
# Run 'sketchybar --query default_menu_items' to find exact names
|
||||
|
||||
# Update the bar
|
||||
${pkgs.sketchybar}/bin/sketchybar --update
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar aerospace workspace plugin
|
||||
home.file.".config/sketchybar/plugins/aerospace.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
# Colors
|
||||
FOCUSED_COLOR=0xff285577
|
||||
ITEM_BG=0xff333333
|
||||
TEXT=0xffffffff
|
||||
GRAY=0xff555555
|
||||
|
||||
# Get the currently focused workspace directly from aerospace
|
||||
# Trim whitespace to ensure clean comparison
|
||||
FOCUSED=$(${pkgs.aerospace}/bin/aerospace list-workspaces --focused | tr -d ' \n\r')
|
||||
|
||||
# Get list of empty workspaces
|
||||
EMPTY_WORKSPACES=$(${pkgs.aerospace}/bin/aerospace list-workspaces --monitor all --empty)
|
||||
|
||||
# Get workspace number - from $1 if provided (event-triggered), otherwise extract from $NAME (routine update)
|
||||
# $NAME is always available (e.g., "space.1", "space.2", etc.)
|
||||
# $1 is only available when called via event trigger with positional argument
|
||||
if [ -n "$1" ]; then
|
||||
WORKSPACE_NUM=$(echo "$1" | tr -d ' \n\r')
|
||||
else
|
||||
# Extract number from item name: "space.1" -> "1", "space.10" -> "10"
|
||||
WORKSPACE_NUM=$(echo "$NAME" | sed 's/space\.//')
|
||||
fi
|
||||
|
||||
# Check if workspace has windows (is NOT empty)
|
||||
IS_EMPTY=false
|
||||
if echo "$EMPTY_WORKSPACES" | grep -q "^$WORKSPACE_NUM$"; then
|
||||
IS_EMPTY=true
|
||||
fi
|
||||
|
||||
# Check if this workspace is focused
|
||||
IS_FOCUSED=false
|
||||
if [ "$WORKSPACE_NUM" = "$FOCUSED" ]; then
|
||||
IS_FOCUSED=true
|
||||
fi
|
||||
|
||||
# Determine display value (workspace 10 displays as "0")
|
||||
if [ "$WORKSPACE_NUM" = "10" ]; then
|
||||
DISPLAY="0"
|
||||
else
|
||||
DISPLAY="$WORKSPACE_NUM"
|
||||
fi
|
||||
|
||||
# Determine visibility and styling
|
||||
# Always show focused workspace (even if empty) with fixed width
|
||||
# Hide non-focused empty workspaces by setting width to 0 (collapsed)
|
||||
# Show non-focused non-empty workspaces with fixed width and inactive styling
|
||||
|
||||
if [ "$IS_FOCUSED" = "true" ]; then
|
||||
# Focused workspace - always show with focused styling and bold font
|
||||
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
||||
drawing=on \
|
||||
icon="$DISPLAY" \
|
||||
width=32 \
|
||||
icon.padding_left=13 \
|
||||
icon.padding_right=11 \
|
||||
icon.align=center \
|
||||
background.color=$FOCUSED_COLOR \
|
||||
background.drawing=on \
|
||||
icon.color=$TEXT \
|
||||
icon.font="Fira Code:Bold:13.0"
|
||||
elif [ "$IS_EMPTY" = "true" ]; then
|
||||
# Empty workspace (not focused) - hide by collapsing width and clearing content
|
||||
# Using width=0 with drawing=on so updates=when_shown continues to run the script
|
||||
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
||||
drawing=on \
|
||||
icon="" \
|
||||
label="" \
|
||||
width=0 \
|
||||
icon.padding_left=0 \
|
||||
icon.padding_right=0 \
|
||||
background.drawing=off
|
||||
else
|
||||
# Non-empty workspace (not focused) - show with inactive styling and white text
|
||||
${pkgs.sketchybar}/bin/sketchybar --set space.$WORKSPACE_NUM \
|
||||
drawing=on \
|
||||
icon="$DISPLAY" \
|
||||
width=32 \
|
||||
icon.padding_left=13 \
|
||||
icon.padding_right=11 \
|
||||
icon.align=center \
|
||||
background.color=$ITEM_BG \
|
||||
background.drawing=on \
|
||||
icon.color=$TEXT \
|
||||
icon.font="Fira Code:Regular:13.0"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar CPU monitoring plugin
|
||||
home.file.".config/sketchybar/plugins/cpu.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
CORE_COUNT=$(sysctl -n machdep.cpu.thread_count)
|
||||
CPU_INFO=$(ps -eo pcpu,user)
|
||||
CPU_SYS=$(echo "$CPU_INFO" | grep -v $(whoami) | sed "s/[^ 0-9\.]//g" | awk "{sum+=\$1} END {print sum/(100.0 * $CORE_COUNT)}")
|
||||
CPU_USER=$(echo "$CPU_INFO" | grep $(whoami) | sed "s/[^ 0-9\.]//g" | awk "{sum+=\$1} END {print sum/(100.0 * $CORE_COUNT)}")
|
||||
CPU_PERCENT="$(echo "$CPU_SYS $CPU_USER" | awk '{printf "%.0f\n", ($1 + $2)*100}')"
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$CPU_PERCENT%"
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar memory monitoring plugin
|
||||
# Shows actual memory pressure (excludes file cache/inactive pages)
|
||||
home.file.".config/sketchybar/plugins/memory.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
# Use awk for all arithmetic to avoid bash integer overflow on large RAM systems
|
||||
# Memory pressure = Anonymous (app memory) + Wired + Compressor RAM
|
||||
# - Anonymous pages: app-allocated memory (heap, stack) - matches Activity Monitor's "App Memory"
|
||||
# - Wired: kernel/system memory that can't be paged out
|
||||
# - Pages occupied by compressor: actual RAM used by compressor (NOT "stored in compressor")
|
||||
TOTAL_RAM=$(sysctl -n hw.memsize)
|
||||
MEMORY_PERCENT=$(vm_stat | awk -v total_ram="$TOTAL_RAM" '
|
||||
/page size of/ { page_size = $8 }
|
||||
/Anonymous pages/ { anon = $3 + 0 }
|
||||
/Pages wired/ { wired = $4 + 0 }
|
||||
/Pages occupied by compressor/ { compressor = $5 + 0 }
|
||||
END {
|
||||
used = (anon + wired + compressor) * page_size
|
||||
printf "%.0f", used / total_ram * 100
|
||||
}
|
||||
')
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$MEMORY_PERCENT%"
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar disk monitoring plugin
|
||||
home.file.".config/sketchybar/plugins/disk.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
# Monitor /System/Volumes/Data which contains user data on APFS
|
||||
# The root / is a read-only snapshot with minimal usage
|
||||
DISK_USAGE=$(df -H /System/Volumes/Data | grep -v Filesystem | awk '{print $5}')
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$DISK_USAGE"
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar battery monitoring plugin
|
||||
home.file.".config/sketchybar/plugins/battery.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
|
||||
CHARGING=$(pmset -g batt | grep 'AC Power')
|
||||
|
||||
if [ "$PERCENTAGE" = "" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Select icon based on battery level
|
||||
case ''${PERCENTAGE} in
|
||||
9[0-9]|100) ICON="🔋"
|
||||
;;
|
||||
[6-8][0-9]) ICON="🔋"
|
||||
;;
|
||||
[3-5][0-9]) ICON="🔋"
|
||||
;;
|
||||
[1-2][0-9]) ICON="🔋"
|
||||
;;
|
||||
*) ICON="🪫"
|
||||
esac
|
||||
|
||||
# Show charging icon if connected to power
|
||||
if [[ $CHARGING != "" ]]; then
|
||||
ICON="⚡"
|
||||
fi
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%"
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar volume monitoring plugin
|
||||
home.file.".config/sketchybar/plugins/volume.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$SENDER" = "volume_change" ]; then
|
||||
VOLUME=$(osascript -e "output volume of (get volume settings)")
|
||||
MUTED=$(osascript -e "output muted of (get volume settings)")
|
||||
|
||||
if [ "$MUTED" = "true" ]; then
|
||||
ICON="🔇"
|
||||
LABEL=""
|
||||
else
|
||||
case $VOLUME in
|
||||
[6-9][0-9]|100) ICON="🔊"
|
||||
;;
|
||||
[3-5][0-9]) ICON="🔉"
|
||||
;;
|
||||
*) ICON="🔈"
|
||||
esac
|
||||
LABEL="$VOLUME%"
|
||||
fi
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME icon="$ICON" label="$LABEL"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# SketchyBar calendar/clock plugin
|
||||
home.file.".config/sketchybar/plugins/calendar.sh" = mkIf cfg.sketchybar.enable {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/bash
|
||||
|
||||
${pkgs.sketchybar}/bin/sketchybar --set $NAME label="$(date '+%Y-%m-%d %H:%M')"
|
||||
'';
|
||||
};
|
||||
|
||||
# Launchd agent for auto-starting sketchybar
|
||||
launchd.agents.sketchybar = mkIf cfg.sketchybar.enable {
|
||||
enable = true;
|
||||
config = {
|
||||
ProgramArguments = [ "${pkgs.sketchybar}/bin/sketchybar" ];
|
||||
RunAtLoad = true;
|
||||
KeepAlive = true;
|
||||
StandardOutPath = "/tmp/sketchybar.log";
|
||||
StandardErrorPath = "/tmp/sketchybar.err.log";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
11
home/roles/base-darwin/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
# Base imports for Darwin home configurations
|
||||
# Includes Darwin-specific roles that only work on macOS
|
||||
imports = [
|
||||
../aerospace
|
||||
];
|
||||
|
||||
# Override to use -d instead of --delete-older-than on Darwin due to launchd bug
|
||||
# https://github.com/nix-community/home-manager/issues/7211
|
||||
nix.gc.options = "-d";
|
||||
}
|
||||
9
home/roles/base-linux/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
# Base imports for Linux home configurations
|
||||
# Includes Linux-specific roles that require Linux-only home-manager modules
|
||||
imports = [
|
||||
../plasma-manager
|
||||
../plasma-manager-kodi
|
||||
../i3+sway
|
||||
];
|
||||
}
|
||||
96
home/roles/base/default.nix
Normal file
@@ -0,0 +1,96 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.base;
|
||||
in
|
||||
{
|
||||
options.home.roles.base = {
|
||||
enable = mkEnableOption "Enable base CLI tools and essential programs";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
fd
|
||||
glances
|
||||
gzip
|
||||
htop
|
||||
killall
|
||||
less
|
||||
ncdu
|
||||
shellcheck
|
||||
tmux
|
||||
tree
|
||||
watch
|
||||
];
|
||||
|
||||
# Automatic garbage collection for user profile (home-manager generations).
|
||||
# This complements system-level gc which only cleans system generations.
|
||||
# - Linux: Uses --delete-older-than to keep 10-day rollback window
|
||||
# - Darwin: Overridden to use -d in base-darwin role to avoid launchd bug
|
||||
# (https://github.com/nix-community/home-manager/issues/7211)
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
randomizedDelaySec = mkIf pkgs.stdenv.isLinux "14m";
|
||||
options = lib.mkDefault "--delete-older-than 10d";
|
||||
};
|
||||
|
||||
# Essential programs everyone needs
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
codex() {
|
||||
local key
|
||||
key="$(rbw get openai-api-key-codex)"
|
||||
OPENAI_API_KEY="$key" command codex "$@"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
programs.command-not-found.enable = true;
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user.name = "John Ogle";
|
||||
user.email = "john@ogle.fyi";
|
||||
safe.directory = "/etc/nixos";
|
||||
};
|
||||
};
|
||||
|
||||
programs.jq.enable = true;
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
matchBlocks = {
|
||||
"*" = {
|
||||
addKeysToAgent = "yes";
|
||||
};
|
||||
"nucdeb1" = {
|
||||
hostname = "nucdeb1.oglehome";
|
||||
user = "root";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.rbw = {
|
||||
enable = true;
|
||||
settings = {
|
||||
email = "john@johnogle.info";
|
||||
base_url = "https://bitwarden.johnogle.info";
|
||||
pinentry = pkgs.pinentry-qt;
|
||||
};
|
||||
};
|
||||
|
||||
# Note: modules must be imported at top-level home config
|
||||
};
|
||||
}
|
||||
26
home/roles/communication/default.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ config, lib, pkgs, globalInputs, system, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.communication;
|
||||
isLinux = pkgs.stdenv.isLinux;
|
||||
in
|
||||
{
|
||||
options.home.roles.communication = {
|
||||
enable = mkEnableOption "Enable communication and messaging applications";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
# For logging back into google chat (cross-platform)
|
||||
globalInputs.google-cookie-retrieval.packages.${system}.default
|
||||
] ++ optionals isLinux [
|
||||
# Linux-only communication apps (Electron apps don't build on Darwin)
|
||||
pkgs.element-desktop
|
||||
# Re-enabled in 25.11 after security issues were resolved
|
||||
pkgs.fluffychat
|
||||
pkgs.nextcloud-talk-desktop
|
||||
];
|
||||
};
|
||||
}
|
||||
23
home/roles/default.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
# Shared roles that work across all platforms (Linux, Darwin, etc.)
|
||||
# Platform-specific roles are imported via base-linux or base-darwin
|
||||
# in each home configuration file
|
||||
imports = [
|
||||
./3d-printing
|
||||
./base
|
||||
./communication
|
||||
./desktop
|
||||
./development
|
||||
./email
|
||||
./gaming
|
||||
./kdeconnect
|
||||
./kubectl
|
||||
./launchers
|
||||
./media
|
||||
./office
|
||||
./sync
|
||||
./tmux
|
||||
./emacs
|
||||
./starship
|
||||
];
|
||||
}
|
||||
210
home/roles/desktop/default.nix
Normal file
@@ -0,0 +1,210 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.desktop;
|
||||
isLinux = pkgs.stdenv.isLinux;
|
||||
in
|
||||
{
|
||||
options.home.roles.desktop = {
|
||||
enable = mkEnableOption "Enable desktop GUI applications and utilities";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
# Cross-platform desktop applications
|
||||
bitwarden-desktop
|
||||
keepassxc
|
||||
xdg-utils # XDG utilities for opening files/URLs with default applications
|
||||
] ++ optionals isLinux [
|
||||
# Linux-only desktop applications
|
||||
dunst
|
||||
unstable.ghostty
|
||||
|
||||
# Linux-only desktop utilities
|
||||
feh # Image viewer and wallpaper setter for X11
|
||||
rofi # Application launcher for X11
|
||||
solaar # Logitech management software
|
||||
waybar
|
||||
wofi # Application launcher for Wayland
|
||||
|
||||
# Linux-only system utilities with GUI components
|
||||
(snapcast.override { pulseaudioSupport = true; })
|
||||
|
||||
# KDE tiling window management (Linux-only)
|
||||
kdePackages.krohnkite # Dynamic tiling extension for KWin 6
|
||||
|
||||
# KDE PIM applications for email, calendar, and contacts (Linux-only)
|
||||
kdePackages.kmail
|
||||
kdePackages.kmail-account-wizard
|
||||
kdePackages.kmailtransport
|
||||
kdePackages.korganizer
|
||||
kdePackages.kaddressbook
|
||||
kdePackages.kontact
|
||||
|
||||
# KDE System components needed for proper integration (Linux-only)
|
||||
kdePackages.kded
|
||||
kdePackages.systemsettings
|
||||
kdePackages.kmenuedit
|
||||
|
||||
# Desktop menu support (Linux-only)
|
||||
kdePackages.plasma-desktop # Contains applications.menu
|
||||
|
||||
# KDE Online Accounts support (Linux-only)
|
||||
kdePackages.kaccounts-integration
|
||||
kdePackages.kaccounts-providers
|
||||
kdePackages.signond
|
||||
|
||||
# KDE Mapping (Linux-only)
|
||||
kdePackages.marble # Virtual globe and world atlas
|
||||
|
||||
# KDE Productivity (Linux-only)
|
||||
kdePackages.kate # Advanced text editor with syntax highlighting
|
||||
kdePackages.okular # Universal document viewer (PDF, ePub, etc.)
|
||||
kdePackages.spectacle # Screenshot capture utility
|
||||
kdePackages.filelight # Visual disk usage analyzer
|
||||
|
||||
# KDE Multimedia (Linux-only)
|
||||
kdePackages.gwenview # Image viewer and basic editor
|
||||
kdePackages.elisa # Music player
|
||||
|
||||
# KDE System Utilities (Linux-only)
|
||||
kdePackages.ark # Archive manager (zip, tar, 7z, etc.)
|
||||
kdePackages.yakuake # Drop-down terminal emulator
|
||||
];
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
programs.spotify-player.enable = true;
|
||||
|
||||
# Linux-only: GNOME keyring service
|
||||
services.gnome-keyring = mkIf isLinux {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Linux-only: systemd user services for rbw vault unlock
|
||||
systemd.user.services = mkIf isLinux {
|
||||
# rbw vault unlock on login
|
||||
rbw-unlock-on-login = {
|
||||
Unit = {
|
||||
Description = "Unlock rbw vault at login";
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.rbw}/bin/rbw unlock";
|
||||
Environment = "RBW_AGENT=${pkgs.rbw}/bin/rbw-agent";
|
||||
# KillMode = "process" prevents systemd from killing the rbw-agent daemon
|
||||
# when this oneshot service completes. The agent is spawned by rbw unlock
|
||||
# and needs to persist after the service exits.
|
||||
KillMode = "process";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
# rbw vault unlock on resume from suspend
|
||||
rbw-unlock-on-resume = {
|
||||
Unit = {
|
||||
Description = "Unlock rbw vault after resume from suspend";
|
||||
After = [ "suspend.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.rbw}/bin/rbw unlock";
|
||||
Environment = "RBW_AGENT=${pkgs.rbw}/bin/rbw-agent";
|
||||
# KillMode = "process" prevents systemd from killing the rbw-agent daemon
|
||||
# when this oneshot service completes. The agent is spawned by rbw unlock
|
||||
# and needs to persist after the service exits.
|
||||
KillMode = "process";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "suspend.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Linux-only: KDE environment variables for proper integration
|
||||
home.sessionVariables = mkIf isLinux {
|
||||
QT_QPA_PLATFORMTHEME = "kde";
|
||||
KDE_SESSION_VERSION = "6";
|
||||
};
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
|
||||
# Ensure desktop files are made available for discovery
|
||||
desktopEntries = {}; # This creates the desktop files directory structure
|
||||
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
associations.added = {
|
||||
# Ensure associations are properly registered
|
||||
"text/html" = "firefox.desktop";
|
||||
"x-scheme-handler/http" = "firefox.desktop";
|
||||
"x-scheme-handler/https" = "firefox.desktop";
|
||||
};
|
||||
defaultApplications = {
|
||||
# Web browsers (cross-platform)
|
||||
"text/html" = "firefox.desktop";
|
||||
"x-scheme-handler/http" = "firefox.desktop";
|
||||
"x-scheme-handler/https" = "firefox.desktop";
|
||||
"x-scheme-handler/about" = "firefox.desktop";
|
||||
"x-scheme-handler/unknown" = "firefox.desktop";
|
||||
} // optionalAttrs isLinux {
|
||||
# Linux-only: KDE application associations
|
||||
# Documents
|
||||
"application/pdf" = "okular.desktop";
|
||||
"text/plain" = "kate.desktop";
|
||||
"text/x-tex" = "kate.desktop";
|
||||
"text/x-c" = "kate.desktop";
|
||||
"text/x-python" = "kate.desktop";
|
||||
"application/x-shellscript" = "kate.desktop";
|
||||
|
||||
# Images
|
||||
"image/png" = "gwenview.desktop";
|
||||
"image/jpeg" = "gwenview.desktop";
|
||||
"image/jpg" = "gwenview.desktop";
|
||||
"image/gif" = "gwenview.desktop";
|
||||
"image/bmp" = "gwenview.desktop";
|
||||
"image/tiff" = "gwenview.desktop";
|
||||
"image/webp" = "gwenview.desktop";
|
||||
|
||||
# Archives
|
||||
"application/zip" = "ark.desktop";
|
||||
"application/x-tar" = "ark.desktop";
|
||||
"application/x-compressed-tar" = "ark.desktop";
|
||||
"application/x-7z-compressed" = "ark.desktop";
|
||||
"application/x-rar" = "ark.desktop";
|
||||
|
||||
# Audio
|
||||
"audio/mpeg" = "elisa.desktop";
|
||||
"audio/mp4" = "elisa.desktop";
|
||||
"audio/flac" = "elisa.desktop";
|
||||
"audio/ogg" = "elisa.desktop";
|
||||
"audio/wav" = "elisa.desktop";
|
||||
|
||||
# Email
|
||||
"message/rfc822" = "kmail.desktop";
|
||||
"x-scheme-handler/mailto" = "kmail.desktop";
|
||||
|
||||
# Calendar
|
||||
"text/calendar" = "korganizer.desktop";
|
||||
"application/x-vnd.akonadi.calendar.event" = "korganizer.desktop";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Linux-only: Fix for KDE applications.menu file issue on Plasma 6
|
||||
# KDE still looks for applications.menu but Plasma 6 renamed it to plasma-applications.menu
|
||||
xdg.configFile."menus/applications.menu" = mkIf isLinux {
|
||||
source = "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu";
|
||||
};
|
||||
|
||||
# Note: modules must be imported at top-level home config
|
||||
};
|
||||
}
|
||||
44
home/roles/development/beads-search-query-optimization.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
diff --git a/internal/storage/dolt/queries.go b/internal/storage/dolt/queries.go
|
||||
index 7d8214ee..8acdaae2 100644
|
||||
--- a/internal/storage/dolt/queries.go
|
||||
+++ b/internal/storage/dolt/queries.go
|
||||
@@ -212,8 +212,21 @@ func (s *DoltStore) SearchIssues(ctx context.Context, query string, filter types
|
||||
}
|
||||
|
||||
// nolint:gosec // G201: whereSQL contains column comparisons with ?, limitSQL is a safe integer
|
||||
+ // Performance fix: SELECT all columns directly instead of id-only + WHERE IN (all_ids)
|
||||
+ // See: hq-ihwsj - bd list uses inefficient WHERE IN (all_ids) query pattern
|
||||
querySQL := fmt.Sprintf(`
|
||||
- SELECT id FROM issues
|
||||
+ SELECT id, content_hash, title, description, design, acceptance_criteria, notes,
|
||||
+ status, priority, issue_type, assignee, estimated_minutes,
|
||||
+ created_at, created_by, owner, updated_at, closed_at, external_ref,
|
||||
+ compaction_level, compacted_at, compacted_at_commit, original_size, source_repo, close_reason,
|
||||
+ deleted_at, deleted_by, delete_reason, original_type,
|
||||
+ sender, ephemeral, pinned, is_template, crystallizes,
|
||||
+ await_type, await_id, timeout_ns, waiters,
|
||||
+ hook_bead, role_bead, agent_state, last_activity, role_type, rig, mol_type,
|
||||
+ event_kind, actor, target, payload,
|
||||
+ due_at, defer_until,
|
||||
+ quality_score, work_type, source_system
|
||||
+ FROM issues
|
||||
%s
|
||||
ORDER BY priority ASC, created_at DESC
|
||||
%s
|
||||
@@ -225,7 +238,15 @@ func (s *DoltStore) SearchIssues(ctx context.Context, query string, filter types
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
- return s.scanIssueIDs(ctx, rows)
|
||||
+ var issues []*types.Issue
|
||||
+ for rows.Next() {
|
||||
+ issue, err := scanIssueRow(rows)
|
||||
+ if err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
+ issues = append(issues, issue)
|
||||
+ }
|
||||
+ return issues, rows.Err()
|
||||
}
|
||||
|
||||
// GetReadyWork returns issues that are ready to work on (not blocked)
|
||||
317
home/roles/development/commands/beads_batch_research_plan.md
Normal file
@@ -0,0 +1,317 @@
|
||||
---
|
||||
description: Batch research and planning for multiple beads with interactive question review
|
||||
model: opus
|
||||
---
|
||||
|
||||
# Beads Batch Research+Plan
|
||||
|
||||
This skill automates the common workflow of:
|
||||
1. Running /beads_research in parallel for multiple beads
|
||||
2. Presenting open questions interactively for user input (bead-by-bead)
|
||||
3. Running /beads_plan for all researched beads (plus any spawned from splits)
|
||||
|
||||
## When to Use
|
||||
|
||||
- You have multiple beads ready for work
|
||||
- You want to research and plan them efficiently before implementation
|
||||
- You prefer to batch your question-answering rather than context-switching between skills
|
||||
|
||||
## Phase 1: Selection
|
||||
|
||||
1. **Get ready beads**: Run `bd ready --limit=20` to list beads with no blockers
|
||||
|
||||
2. **Filter already-researched beads**:
|
||||
For each ready bead, check if it already has research:
|
||||
```bash
|
||||
ls thoughts/beads-{bead-id}/research.md 2>/dev/null
|
||||
```
|
||||
|
||||
Categorize beads:
|
||||
- **Needs research**: No `research.md` exists
|
||||
- **Has research, needs plan**: `research.md` exists but no `plan.md`
|
||||
- **Already planned**: Both `research.md` and `plan.md` exist
|
||||
|
||||
3. **Present selection**:
|
||||
```
|
||||
Ready beads available for batch research+plan:
|
||||
|
||||
NEEDS RESEARCH:
|
||||
- {bead-id}: {title} (type: {type})
|
||||
- ...
|
||||
|
||||
HAS RESEARCH (plan only):
|
||||
- {bead-id}: {title} (type: {type})
|
||||
- ...
|
||||
|
||||
ALREADY PLANNED (skip):
|
||||
- {bead-id}: {title}
|
||||
|
||||
Which beads would you like to process?
|
||||
```
|
||||
|
||||
4. **Use AskUserQuestion** with `multiSelect: true`:
|
||||
- Include bead ID and title for each option
|
||||
- Separate options by category
|
||||
- Allow selection across categories
|
||||
|
||||
## Phase 2: Parallel Research
|
||||
|
||||
For each selected bead that NEEDS RESEARCH, launch a research subagent.
|
||||
|
||||
### Subagent Instructions Template
|
||||
|
||||
```
|
||||
Research bead [BEAD_ID]: [BEAD_TITLE]
|
||||
|
||||
1. **Load bead context**:
|
||||
```bash
|
||||
bd show [BEAD_ID]
|
||||
```
|
||||
|
||||
2. **Create artifact directory**:
|
||||
```bash
|
||||
mkdir -p thoughts/beads-[BEAD_ID]
|
||||
```
|
||||
|
||||
3. **Conduct research** following beads_research.md patterns:
|
||||
- Analyze and decompose the research question
|
||||
- Spawn parallel sub-agent tasks (codebase-locator, codebase-analyzer, etc.)
|
||||
- Synthesize findings
|
||||
|
||||
4. **Write research document** to `thoughts/beads-[BEAD_ID]/research.md`:
|
||||
- Include frontmatter with metadata
|
||||
- Document findings with file:line references
|
||||
- **CRITICAL**: Include "## Open Questions" section listing any unresolved items
|
||||
|
||||
5. **Return summary**:
|
||||
- Research status (complete/partial)
|
||||
- Number of open questions
|
||||
- Key findings summary (2-3 bullet points)
|
||||
- List of open questions verbatim
|
||||
```
|
||||
|
||||
### Launching Subagents
|
||||
|
||||
Use `subagent_type: "opus"` for research subagents (matches beads_research model setting).
|
||||
|
||||
Launch ALL research subagents in a single message for parallel execution:
|
||||
```
|
||||
<Task calls for each selected bead needing research - all in one message>
|
||||
```
|
||||
|
||||
### Collecting Results
|
||||
|
||||
Wait for ALL research subagents to complete. Collect:
|
||||
- Bead ID
|
||||
- Research status
|
||||
- Open questions list
|
||||
- Any errors encountered
|
||||
|
||||
## Phase 3: Interactive Question Review
|
||||
|
||||
Present each bead's open questions sequentially for user input.
|
||||
|
||||
### For Each Bead (in order):
|
||||
|
||||
1. **Present research summary**:
|
||||
```
|
||||
## Bead {N}/{total}: {bead-id} - {title}
|
||||
|
||||
Research complete. Key findings:
|
||||
- {finding 1}
|
||||
- {finding 2}
|
||||
|
||||
Open questions requiring your input:
|
||||
1. {question 1}
|
||||
2. {question 2}
|
||||
|
||||
Additionally:
|
||||
- Should this bead be split into multiple beads? (y/n)
|
||||
- If split, describe the split:
|
||||
```
|
||||
|
||||
2. **Collect user responses**:
|
||||
- Answers to open questions
|
||||
- Split decision (yes/no)
|
||||
- If split: new bead titles and how to divide the work
|
||||
|
||||
3. **Handle splits**:
|
||||
If user indicates a split:
|
||||
```bash
|
||||
# Create new beads for split work
|
||||
bd create --title="{split title 1}" --type={type} --priority={priority} \
|
||||
--description="{description based on user input}"
|
||||
|
||||
# Update original bead if scope narrowed
|
||||
bd update {original-bead-id} --description="{updated description}"
|
||||
```
|
||||
|
||||
Track new bead IDs for inclusion in planning phase.
|
||||
|
||||
4. **Update research document**:
|
||||
Append user answers to `thoughts/beads-{id}/research.md`:
|
||||
```markdown
|
||||
## User Clarifications [{timestamp}]
|
||||
|
||||
Q: {question 1}
|
||||
A: {user answer 1}
|
||||
|
||||
Q: {question 2}
|
||||
A: {user answer 2}
|
||||
|
||||
## Bead Splits
|
||||
{If split: description of split and new bead IDs}
|
||||
```
|
||||
|
||||
### Progress Tracking
|
||||
|
||||
After each bead's questions are answered, confirm before moving to next:
|
||||
```
|
||||
Questions answered for {bead-id}. {N-1} beads remaining.
|
||||
Continue to next bead? (y/n)
|
||||
```
|
||||
|
||||
### Beads with No Questions
|
||||
|
||||
If a bead's research had no open questions:
|
||||
```
|
||||
## Bead {N}/{total}: {bead-id} - {title}
|
||||
|
||||
Research complete with no open questions.
|
||||
|
||||
Key findings:
|
||||
- {finding 1}
|
||||
- {finding 2}
|
||||
|
||||
Should this bead be split? (y/n)
|
||||
```
|
||||
|
||||
## Phase 4: Parallel Planning
|
||||
|
||||
After all questions answered, launch planning subagents for all beads.
|
||||
|
||||
### Beads to Plan
|
||||
|
||||
Include:
|
||||
- Original beads that were researched
|
||||
- Beads that had existing research (from selection phase)
|
||||
- New beads spawned from splits
|
||||
|
||||
### Subagent Instructions Template
|
||||
|
||||
```
|
||||
Create implementation plan for bead [BEAD_ID]: [BEAD_TITLE]
|
||||
|
||||
1. **Load context**:
|
||||
```bash
|
||||
bd show [BEAD_ID]
|
||||
```
|
||||
|
||||
2. **Read research** (it exists and has user clarifications):
|
||||
Read `thoughts/beads-[BEAD_ID]/research.md` FULLY
|
||||
|
||||
3. **Create plan** following beads_plan.md patterns:
|
||||
- Context gathering via sub-agents
|
||||
- Design approach based on research findings and user clarifications
|
||||
- **Skip interactive questions** - they were already answered in research review
|
||||
|
||||
4. **Write plan** to `thoughts/beads-[BEAD_ID]/plan.md`:
|
||||
- Full plan structure with phases
|
||||
- Success criteria (automated and manual)
|
||||
- References to research document
|
||||
|
||||
5. **Update bead**:
|
||||
```bash
|
||||
bd update [BEAD_ID] --notes="Plan created: thoughts/beads-[BEAD_ID]/plan.md"
|
||||
```
|
||||
|
||||
6. **Return summary**:
|
||||
- Plan status (complete/failed)
|
||||
- Number of phases
|
||||
- Estimated complexity (small/medium/large)
|
||||
- Any issues encountered
|
||||
```
|
||||
|
||||
### Launching Subagents
|
||||
|
||||
Use `subagent_type: "opus"` for planning subagents (matches beads_plan model setting).
|
||||
|
||||
Launch ALL planning subagents in a single message:
|
||||
```
|
||||
<Task calls for each bead to plan - all in one message>
|
||||
```
|
||||
|
||||
### Handling Beads Without Research
|
||||
|
||||
For beads that had existing research but user didn't review questions:
|
||||
- Planning subagent reads existing research
|
||||
- If research has unresolved open questions, subagent should flag this in its return
|
||||
|
||||
## Phase 5: Summary
|
||||
|
||||
After all planning completes, present final summary.
|
||||
|
||||
### Summary Format
|
||||
|
||||
```
|
||||
## Batch Research+Plan Complete
|
||||
|
||||
### Successfully Processed:
|
||||
| Bead | Title | Research | Plan | Phases | Complexity |
|
||||
|------|-------|----------|------|--------|------------|
|
||||
| {id} | {title} | Complete | Complete | 3 | medium |
|
||||
| {id} | {title} | Complete | Complete | 2 | small |
|
||||
|
||||
### New Beads (from splits):
|
||||
| Bead | Title | Parent | Status |
|
||||
|------|-------|--------|--------|
|
||||
| {new-id} | {title} | {parent-id} | Planned |
|
||||
|
||||
### Failed:
|
||||
| Bead | Title | Phase Failed | Error |
|
||||
|------|-------|--------------|-------|
|
||||
| {id} | {title} | Research | Timeout |
|
||||
|
||||
### Next Steps:
|
||||
1. Review plans at `thoughts/beads-{id}/plan.md`
|
||||
2. Run `/parallel_beads` to implement all planned beads
|
||||
3. Or run `/beads_implement {id}` for individual implementation
|
||||
|
||||
### Artifacts Created:
|
||||
- Research: thoughts/beads-{id}/research.md (x{N} files)
|
||||
- Plans: thoughts/beads-{id}/plan.md (x{N} files)
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Research Subagent Failure
|
||||
- Log the failure with bead ID and error
|
||||
- Continue with other beads
|
||||
- Exclude failed beads from question review and planning
|
||||
- Report in final summary
|
||||
|
||||
### Planning Subagent Failure
|
||||
- Log the failure with bead ID and error
|
||||
- Research still valid - can retry planning manually
|
||||
- Report in final summary
|
||||
|
||||
### User Cancellation During Question Review
|
||||
- Save progress to bead notes
|
||||
- Report which beads were completed
|
||||
- User can resume with remaining beads in new session
|
||||
|
||||
### Split Bead Creation Failure
|
||||
- Report error but continue with original bead
|
||||
- User can manually create split beads later
|
||||
|
||||
## Resource Limits
|
||||
|
||||
- Maximum concurrent research subagents: 5
|
||||
- Maximum concurrent planning subagents: 5
|
||||
- If more beads selected, process in batches
|
||||
|
||||
## Notes
|
||||
|
||||
- This skill is designed for the "research+plan before implementation" workflow
|
||||
- Pairs well with `/parallel_beads` for subsequent implementation
|
||||
- Run `/reconcile_beads` after implementation PRs merge
|
||||
253
home/roles/development/commands/beads_implement.md
Normal file
@@ -0,0 +1,253 @@
|
||||
---
|
||||
description: Implement a plan from thoughts/ for a bead issue
|
||||
---
|
||||
|
||||
# Beads Implement
|
||||
|
||||
You are tasked with implementing an approved plan for a bead issue. Plans are stored in `thoughts/beads-{id}/plan.md`.
|
||||
|
||||
## Initial Setup
|
||||
|
||||
When this command is invoked:
|
||||
|
||||
1. **Parse the input for bead ID**:
|
||||
- If a bead ID is provided, use it
|
||||
- If no bead ID, check for beads with plans:
|
||||
```bash
|
||||
bd list --status=in_progress
|
||||
```
|
||||
Then check which have plans in `thoughts/beads-{id}/plan.md`
|
||||
|
||||
2. **Load bead context**:
|
||||
```bash
|
||||
bd show {bead-id}
|
||||
```
|
||||
Note the bead **type** (bug, feature, task) from the output.
|
||||
|
||||
3. **Check for plan and handle by type**:
|
||||
|
||||
Check if plan exists:
|
||||
```bash
|
||||
ls thoughts/beads-{bead-id}/plan.md 2>/dev/null
|
||||
```
|
||||
|
||||
**If plan exists**: Proceed normally (skip to step 4)
|
||||
|
||||
**If no plan**:
|
||||
- **type=bug**: Proceed without plan (simple bugs can implement directly)
|
||||
- **type=feature or type=task**: Warn and ask:
|
||||
```
|
||||
No plan found for this {type}.
|
||||
|
||||
Plans help ensure complex work is well-designed and verifiable.
|
||||
Location expected: thoughts/beads-{bead-id}/plan.md
|
||||
|
||||
Options:
|
||||
1. Create a plan first (recommended) - Run /beads_plan {bead-id}
|
||||
2. Proceed without a plan (for simple changes)
|
||||
|
||||
How would you like to proceed?
|
||||
```
|
||||
Wait for user response before continuing.
|
||||
|
||||
4. **Load plan and research context** (if plan exists):
|
||||
- Read `thoughts/beads-{bead-id}/plan.md` FULLY
|
||||
- Check for any existing checkmarks (- [x]) indicating partial progress
|
||||
- Read any research at `thoughts/beads-{bead-id}/research.md`
|
||||
- If plan's Success Criteria references contribution guidelines (e.g., "Per CONTRIBUTING.md:"),
|
||||
verify the original CONTRIBUTING.md still exists and requirements are current
|
||||
|
||||
5. **Mark bead in progress** (if not already):
|
||||
```bash
|
||||
bd update {bead-id} --status=in_progress
|
||||
```
|
||||
|
||||
6. **Respond with**:
|
||||
```
|
||||
Implementing plan for bead {bead-id}: {bead-title}
|
||||
|
||||
Plan location: thoughts/beads-{bead-id}/plan.md
|
||||
{If partial progress: "Resuming from Phase X - previous phases completed."}
|
||||
|
||||
I'll implement each phase and verify success criteria before proceeding.
|
||||
```
|
||||
|
||||
## Implementation Process
|
||||
|
||||
### Step 1: Understand the Plan
|
||||
|
||||
1. **Read the plan completely**
|
||||
2. **Check for existing progress** (checkmarked items)
|
||||
3. **Read all files mentioned in the plan**
|
||||
4. **Create a TodoWrite list** tracking each phase
|
||||
|
||||
### Step 2: Implement Each Phase
|
||||
|
||||
For each phase in the plan:
|
||||
|
||||
1. **Announce the phase**:
|
||||
```
|
||||
## Starting Phase {N}: {Phase Name}
|
||||
|
||||
This phase will: {overview from plan}
|
||||
```
|
||||
|
||||
2. **Make the changes**:
|
||||
- Follow the plan's specific instructions
|
||||
- Use Edit tool for modifications
|
||||
- Create new files only when specified
|
||||
|
||||
3. **Run automated verification**:
|
||||
- Execute each command in "Automated Verification"
|
||||
- Fix any issues before proceeding
|
||||
|
||||
4. **Update plan checkboxes**:
|
||||
- Use Edit tool to check off completed items in the plan
|
||||
- This enables resume if session is interrupted
|
||||
|
||||
5. **Update bead notes** with progress:
|
||||
```bash
|
||||
bd update {bead-id} --notes="Phase {N} complete. Automated verification passed."
|
||||
```
|
||||
|
||||
### Step 3: Per-Plan Checkpoint
|
||||
|
||||
**CRITICAL**: After completing ALL phases and ALL automated verification:
|
||||
|
||||
```
|
||||
## Implementation Complete - Ready for Manual Verification
|
||||
|
||||
All phases completed and automated verification passed:
|
||||
- [ ] Phase 1: {name} - DONE
|
||||
- [ ] Phase 2: {name} - DONE
|
||||
- [ ] ...
|
||||
|
||||
**Automated checks passed:**
|
||||
- {List of automated checks that passed}
|
||||
|
||||
**Please perform manual verification:**
|
||||
- {List manual verification items from plan}
|
||||
|
||||
Let me know when manual testing is complete so I can close the bead.
|
||||
|
||||
**Contribution guidelines compliance:**
|
||||
- {List any contribution guideline requirements that were part of Success Criteria}
|
||||
- {Note if any requirements could not be automated and need manual review}
|
||||
```
|
||||
|
||||
**STOP HERE and wait for user confirmation.**
|
||||
|
||||
Do NOT:
|
||||
- Close the bead automatically
|
||||
- Proceed to "next steps" without confirmation
|
||||
- Start additional work
|
||||
|
||||
### Step 4: After Manual Verification
|
||||
|
||||
When user confirms manual verification passed:
|
||||
|
||||
1. **Update plan status**:
|
||||
- Edit the plan's frontmatter: `status: complete`
|
||||
|
||||
2. **Close the bead**:
|
||||
```bash
|
||||
bd close {bead-id} --reason="Implementation complete. All verification passed."
|
||||
```
|
||||
|
||||
3. **Final summary**:
|
||||
```
|
||||
Bead {bead-id} closed.
|
||||
|
||||
Summary:
|
||||
- {What was implemented}
|
||||
- {Key changes made}
|
||||
|
||||
Artifacts:
|
||||
- Plan: thoughts/beads-{bead-id}/plan.md
|
||||
- {Any other artifacts created}
|
||||
```
|
||||
|
||||
## Handling Issues
|
||||
|
||||
### When something doesn't match the plan:
|
||||
|
||||
```
|
||||
Issue in Phase {N}:
|
||||
|
||||
Expected: {what the plan says}
|
||||
Found: {actual situation}
|
||||
Why this matters: {explanation}
|
||||
|
||||
Options:
|
||||
1. Adapt the implementation to work with current state
|
||||
2. Update the plan to reflect reality
|
||||
3. Stop and investigate further
|
||||
|
||||
How should I proceed?
|
||||
```
|
||||
|
||||
### When tests fail:
|
||||
|
||||
1. **Analyze the failure**
|
||||
2. **Attempt to fix** if the fix is clear and within scope
|
||||
3. **If fix is unclear**, report:
|
||||
```
|
||||
Test failure in Phase {N}:
|
||||
|
||||
Failing test: {test name}
|
||||
Error: {error message}
|
||||
|
||||
I've attempted: {what you tried}
|
||||
|
||||
This may require: {your assessment}
|
||||
```
|
||||
|
||||
### When blocked:
|
||||
|
||||
```
|
||||
Blocked in Phase {N}:
|
||||
|
||||
Blocker: {description}
|
||||
Impact: {what can't proceed}
|
||||
|
||||
Suggested resolution: {your recommendation}
|
||||
```
|
||||
|
||||
## Resuming Work
|
||||
|
||||
If the plan has existing checkmarks:
|
||||
|
||||
1. **Trust completed work** - don't re-verify unless something seems off
|
||||
2. **Pick up from first unchecked item**
|
||||
3. **Verify previous work only if** current phase depends on it and seems broken
|
||||
|
||||
## Important Guidelines
|
||||
|
||||
1. **Follow the plan's intent** while adapting to reality
|
||||
2. **Implement each phase fully** before moving to next
|
||||
3. **Update checkboxes in real-time** as you complete items
|
||||
4. **One checkpoint per plan** - not per phase
|
||||
5. **Never close bead** without manual verification confirmation
|
||||
6. **Keep bead notes updated** with progress
|
||||
|
||||
## Session Close Protocol
|
||||
|
||||
If you need to end the session before completion:
|
||||
|
||||
1. **Update plan** with current progress (checkboxes)
|
||||
2. **Update bead notes**:
|
||||
```bash
|
||||
bd update {bead-id} --notes="In progress: Phase {N} partially complete. Next: {what's next}"
|
||||
```
|
||||
3. **Inform user** of status and how to resume
|
||||
|
||||
## Example Invocation
|
||||
|
||||
```
|
||||
User: /beads:implement nixos-configs-abc123
|
||||
Assistant: Implementing plan for bead nixos-configs-abc123...
|
||||
|
||||
## Starting Phase 1: Database Schema
|
||||
|
||||
This phase will add the new user_preferences table...
|
||||
```
|
||||
214
home/roles/development/commands/beads_iterate.md
Normal file
@@ -0,0 +1,214 @@
|
||||
---
|
||||
description: Iterate on existing implementation plans for a bead issue
|
||||
model: opus
|
||||
---
|
||||
|
||||
# Beads Iterate
|
||||
|
||||
You are tasked with updating existing implementation plans based on feedback. Plans are stored in `thoughts/beads-{id}/plan.md`.
|
||||
|
||||
## Initial Setup
|
||||
|
||||
When this command is invoked:
|
||||
|
||||
1. **Parse the input**:
|
||||
- Bead ID (required or ask for it)
|
||||
- Requested changes/feedback (can be provided with command or after)
|
||||
|
||||
2. **Handle different scenarios**:
|
||||
|
||||
**No bead ID provided**:
|
||||
```
|
||||
Which bead's plan would you like to iterate on?
|
||||
|
||||
Recent beads with plans:
|
||||
{list beads that have thoughts/beads-{id}/plan.md}
|
||||
```
|
||||
|
||||
**Bead ID but no feedback**:
|
||||
```
|
||||
I've found the plan at thoughts/beads-{bead-id}/plan.md
|
||||
|
||||
What changes would you like to make? For example:
|
||||
- "Add a phase for migration handling"
|
||||
- "Update success criteria to include performance tests"
|
||||
- "Adjust scope to exclude feature X"
|
||||
- "Split Phase 2 into two separate phases"
|
||||
```
|
||||
|
||||
**Both bead ID and feedback provided**:
|
||||
- Proceed immediately to Step 1
|
||||
|
||||
## Iteration Process
|
||||
|
||||
### Step 1: Understand Current Plan
|
||||
|
||||
1. **Read the existing plan COMPLETELY**:
|
||||
```bash
|
||||
cat thoughts/beads-{bead-id}/plan.md
|
||||
```
|
||||
- Understand current structure, phases, scope
|
||||
- Note success criteria and approach
|
||||
|
||||
2. **Read the bead for context**:
|
||||
```bash
|
||||
bd show {bead-id}
|
||||
```
|
||||
|
||||
3. **Understand requested changes**:
|
||||
- Parse what user wants to add/modify/remove
|
||||
- Identify if changes require codebase research
|
||||
|
||||
### Step 2: Research If Needed
|
||||
|
||||
**Only if changes require new technical understanding:**
|
||||
|
||||
1. **Spawn parallel research tasks**:
|
||||
- **codebase-locator**: Find relevant files
|
||||
- **codebase-analyzer**: Understand implementation details
|
||||
- **codebase-pattern-finder**: Find similar patterns
|
||||
|
||||
2. **Be specific about directories** in prompts
|
||||
|
||||
3. **Wait for ALL tasks** before proceeding
|
||||
|
||||
### Step 3: Present Understanding
|
||||
|
||||
Before making changes:
|
||||
|
||||
```
|
||||
Based on your feedback, I understand you want to:
|
||||
- {Change 1 with specific detail}
|
||||
- {Change 2 with specific detail}
|
||||
|
||||
{If research was needed:}
|
||||
My research found:
|
||||
- {Relevant discovery}
|
||||
- {Important constraint}
|
||||
|
||||
I plan to update the plan by:
|
||||
1. {Specific modification}
|
||||
2. {Another modification}
|
||||
|
||||
Does this align with your intent?
|
||||
```
|
||||
|
||||
Get user confirmation before proceeding.
|
||||
|
||||
### Step 4: Update the Plan
|
||||
|
||||
1. **Make focused, precise edits**:
|
||||
- Use Edit tool for surgical changes
|
||||
- Maintain existing structure unless explicitly changing it
|
||||
- Keep file:line references accurate
|
||||
|
||||
2. **Ensure consistency**:
|
||||
- New phases follow existing pattern
|
||||
- Update "What We're NOT Doing" if scope changes
|
||||
- Maintain automated vs manual success criteria distinction
|
||||
|
||||
3. **Update plan metadata**:
|
||||
- Update frontmatter `date` to current timestamp
|
||||
- Add `iteration: {N}` to frontmatter
|
||||
- Add `iteration_reason: "{brief description}"` to frontmatter
|
||||
|
||||
4. **Preserve completed work**:
|
||||
- Don't uncheck items that were already completed
|
||||
- If changing completed phases, discuss with user first
|
||||
|
||||
### Step 5: Save Iteration History (Optional)
|
||||
|
||||
For significant changes, save the previous version:
|
||||
|
||||
```bash
|
||||
cp thoughts/beads-{bead-id}/plan.md thoughts/beads-{bead-id}/plan-v{N}.md
|
||||
```
|
||||
|
||||
Then update the main plan.
|
||||
|
||||
### Step 6: Update Bead
|
||||
|
||||
```bash
|
||||
bd update {bead-id} --notes="Plan iterated: {brief description of changes}"
|
||||
```
|
||||
|
||||
### Step 7: Present Changes
|
||||
|
||||
```
|
||||
I've updated the plan at `thoughts/beads-{bead-id}/plan.md`
|
||||
|
||||
Changes made:
|
||||
- {Specific change 1}
|
||||
- {Specific change 2}
|
||||
|
||||
The updated plan now:
|
||||
- {Key improvement}
|
||||
- {Another improvement}
|
||||
|
||||
Would you like any further adjustments?
|
||||
```
|
||||
|
||||
## Important Guidelines
|
||||
|
||||
1. **Be Skeptical**:
|
||||
- Don't blindly accept changes that seem problematic
|
||||
- Question vague feedback - ask for clarification
|
||||
- Point out conflicts with existing phases
|
||||
|
||||
2. **Be Surgical**:
|
||||
- Make precise edits, not wholesale rewrites
|
||||
- Preserve good content that doesn't need changing
|
||||
- Only research what's necessary
|
||||
|
||||
3. **Be Thorough**:
|
||||
- Read entire plan before making changes
|
||||
- Ensure updated sections maintain quality
|
||||
- Verify success criteria are still measurable
|
||||
|
||||
4. **Be Interactive**:
|
||||
- Confirm understanding before making changes
|
||||
- Allow course corrections
|
||||
- Don't disappear into research without communicating
|
||||
|
||||
5. **No Open Questions**:
|
||||
- If changes raise questions, ASK
|
||||
- Don't update plan with unresolved questions
|
||||
|
||||
## Success Criteria Guidelines
|
||||
|
||||
When updating success criteria, maintain two categories:
|
||||
|
||||
**Automated Verification**:
|
||||
- Commands: `make test`, `npm run lint`
|
||||
- Prefer `make` commands when available
|
||||
- File existence checks
|
||||
|
||||
**Manual Verification**:
|
||||
- UI/UX functionality
|
||||
- Performance under real conditions
|
||||
- Edge cases hard to automate
|
||||
|
||||
## Handling Major Changes
|
||||
|
||||
If feedback requires significant restructuring:
|
||||
|
||||
1. **Discuss scope** before proceeding
|
||||
2. **Consider if this should be a new plan** instead of iteration
|
||||
3. **Preserve the original** in `plan-v{N}.md`
|
||||
4. **Update bead description** if scope changed significantly
|
||||
|
||||
## Example Invocations
|
||||
|
||||
**With full context**:
|
||||
```
|
||||
User: /beads:iterate nixos-configs-abc123 - add error handling phase
|
||||
Assistant: Based on your feedback, I understand you want to add a new phase for error handling...
|
||||
```
|
||||
|
||||
**Interactive**:
|
||||
```
|
||||
User: /beads:iterate nixos-configs-abc123
|
||||
Assistant: I've found the plan. What changes would you like to make?
|
||||
User: Split Phase 2 into backend and frontend phases
|
||||
Assistant: I'll split Phase 2 into two separate phases...
|
||||
```
|
||||
306
home/roles/development/commands/beads_plan.md
Normal file
@@ -0,0 +1,306 @@
|
||||
---
|
||||
description: Create detailed implementation plans for a bead issue
|
||||
model: opus
|
||||
---
|
||||
|
||||
# Beads Plan
|
||||
|
||||
You are tasked with creating detailed implementation plans for a bead issue. This skill integrates with the beads issue tracker and stores plans in the `thoughts/` directory.
|
||||
|
||||
## Initial Setup
|
||||
|
||||
When this command is invoked:
|
||||
|
||||
1. **Parse the input for bead ID**:
|
||||
- If a bead ID is provided, use it
|
||||
- If no bead ID, run `bd ready` and ask which bead to plan for
|
||||
|
||||
2. **Load bead context**:
|
||||
```bash
|
||||
bd show {bead-id}
|
||||
```
|
||||
- Read the bead description for requirements
|
||||
- Check for existing research: `thoughts/beads-{bead-id}/research.md`
|
||||
- Note any dependencies or blockers
|
||||
|
||||
3. **Create artifact directory**:
|
||||
```bash
|
||||
mkdir -p thoughts/beads-{bead-id}
|
||||
```
|
||||
|
||||
4. **Check for existing research**:
|
||||
- If `thoughts/beads-{bead-id}/research.md` exists, read it fully
|
||||
- This research provides crucial context for planning
|
||||
|
||||
5. **Respond with**:
|
||||
```
|
||||
Creating implementation plan for bead {bead-id}: {bead-title}
|
||||
|
||||
{If research exists: "Found existing research at thoughts/beads-{bead-id}/research.md - incorporating findings."}
|
||||
|
||||
Let me analyze the requirements and codebase to create a detailed plan.
|
||||
```
|
||||
|
||||
## Planning Process
|
||||
|
||||
### Step 1: Context Gathering
|
||||
|
||||
1. **Read all mentioned files FULLY**:
|
||||
- Bead description references
|
||||
- Existing research document
|
||||
- Any linked tickets or docs
|
||||
- Use Read tool WITHOUT limit/offset
|
||||
|
||||
2. **Check for contribution guidelines**:
|
||||
|
||||
```bash
|
||||
# Check standard locations for contribution guidelines
|
||||
for f in CONTRIBUTING.md .github/CONTRIBUTING.md docs/CONTRIBUTING.md; do
|
||||
if [ -f "$f" ]; then
|
||||
echo "Found: $f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
```
|
||||
|
||||
If found:
|
||||
- Read the file fully
|
||||
- Extract actionable requirements (testing, code style, documentation, PR conventions)
|
||||
- These requirements MUST be incorporated into the plan's Success Criteria
|
||||
|
||||
If not found, note "No contribution guidelines found" and proceed.
|
||||
|
||||
3. **Spawn initial research tasks**:
|
||||
- **codebase-locator**: Find all files related to the task
|
||||
- **codebase-analyzer**: Understand current implementation
|
||||
- **codebase-pattern-finder**: Find similar features to model after
|
||||
- **thoughts-locator**: Find any existing plans or decisions
|
||||
|
||||
4. **Read all files identified by research**:
|
||||
- Read them FULLY into main context
|
||||
- Cross-reference with requirements
|
||||
|
||||
### Step 2: Present Understanding
|
||||
|
||||
Before writing the plan, confirm understanding:
|
||||
|
||||
```
|
||||
Based on the bead and my research, I understand we need to [accurate summary].
|
||||
|
||||
I've found that:
|
||||
- [Current implementation detail with file:line reference]
|
||||
- [Relevant pattern or constraint discovered]
|
||||
- [Potential complexity or edge case identified]
|
||||
|
||||
Questions that my research couldn't answer:
|
||||
- [Specific technical question requiring human judgment]
|
||||
- [Business logic clarification]
|
||||
```
|
||||
|
||||
Only ask questions you genuinely cannot answer through code investigation.
|
||||
|
||||
### Step 3: Research & Discovery
|
||||
|
||||
After getting clarifications:
|
||||
|
||||
1. **If user corrects any misunderstanding**:
|
||||
- Spawn new research tasks to verify
|
||||
- Read specific files/directories mentioned
|
||||
- Only proceed once verified
|
||||
|
||||
2. **Present design options**:
|
||||
```
|
||||
Based on my research:
|
||||
|
||||
**Current State:**
|
||||
- [Key discovery about existing code]
|
||||
- [Pattern or convention to follow]
|
||||
|
||||
**Design Options:**
|
||||
1. [Option A] - [pros/cons]
|
||||
2. [Option B] - [pros/cons]
|
||||
|
||||
Which approach aligns best?
|
||||
```
|
||||
|
||||
### Step 4: Plan Structure
|
||||
|
||||
Once aligned on approach:
|
||||
|
||||
```
|
||||
Here's my proposed plan structure:
|
||||
|
||||
## Overview
|
||||
[1-2 sentence summary]
|
||||
|
||||
## Implementation Phases:
|
||||
1. [Phase name] - [what it accomplishes]
|
||||
2. [Phase name] - [what it accomplishes]
|
||||
|
||||
Does this phasing make sense?
|
||||
```
|
||||
|
||||
Get feedback on structure before writing details.
|
||||
|
||||
### Step 5: Write the Plan
|
||||
|
||||
Write to `thoughts/beads-{bead-id}/plan.md`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
date: {ISO timestamp}
|
||||
bead_id: {bead-id}
|
||||
bead_title: "{bead title}"
|
||||
author: claude
|
||||
git_commit: {commit hash}
|
||||
branch: {branch name}
|
||||
repository: {repo name}
|
||||
status: draft
|
||||
---
|
||||
|
||||
# {Feature/Task Name} Implementation Plan
|
||||
|
||||
## Overview
|
||||
|
||||
{Brief description of what we're implementing and why}
|
||||
|
||||
## Current State Analysis
|
||||
|
||||
{What exists now, what's missing, key constraints}
|
||||
|
||||
### Key Discoveries:
|
||||
- {Finding with file:line reference}
|
||||
- {Pattern to follow}
|
||||
|
||||
## Desired End State
|
||||
|
||||
{Specification of desired end state and how to verify it}
|
||||
|
||||
## What We're NOT Doing
|
||||
|
||||
{Explicitly list out-of-scope items}
|
||||
|
||||
## Implementation Approach
|
||||
|
||||
{High-level strategy and reasoning}
|
||||
|
||||
## Phase 1: {Descriptive Name}
|
||||
|
||||
### Overview
|
||||
{What this phase accomplishes}
|
||||
|
||||
### Changes Required:
|
||||
|
||||
#### 1. {Component/File Group}
|
||||
**File**: `path/to/file.ext`
|
||||
**Changes**: {Summary}
|
||||
|
||||
```{language}
|
||||
// Specific code to add/modify
|
||||
```
|
||||
|
||||
### Success Criteria:
|
||||
|
||||
#### Automated Verification:
|
||||
- [ ] Tests pass: `make test`
|
||||
- [ ] Linting passes: `make lint`
|
||||
- [ ] Type checking passes: `make typecheck`
|
||||
|
||||
#### Manual Verification:
|
||||
- [ ] Feature works as expected in UI
|
||||
- [ ] Edge cases handled correctly
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: {Descriptive Name}
|
||||
{Similar structure...}
|
||||
|
||||
---
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Unit Tests:
|
||||
- {What to test}
|
||||
- {Key edge cases}
|
||||
|
||||
### Integration Tests:
|
||||
- {End-to-end scenarios}
|
||||
|
||||
### Manual Testing Steps:
|
||||
1. {Specific step}
|
||||
2. {Another step}
|
||||
|
||||
## References
|
||||
|
||||
- Bead: {bead-id}
|
||||
- Research: `thoughts/beads-{bead-id}/research.md`
|
||||
- Similar implementation: {file:line}
|
||||
```
|
||||
|
||||
### Step 6: Update the bead
|
||||
|
||||
```bash
|
||||
bd update {bead-id} --notes="Plan created: thoughts/beads-{bead-id}/plan.md"
|
||||
```
|
||||
|
||||
### Step 7: Create implementation bead (if appropriate)
|
||||
|
||||
If the planning bead is separate from implementation:
|
||||
|
||||
```bash
|
||||
bd create --title="Implement: {feature name}" --type=task --priority=1 \
|
||||
--description="Implement the plan at thoughts/beads-{original-bead-id}/plan.md
|
||||
|
||||
See bead {original-bead-id} for planning context."
|
||||
|
||||
# Link as dependency
|
||||
bd dep add {new-bead-id} {original-bead-id}
|
||||
```
|
||||
|
||||
### Step 8: Present for Review
|
||||
|
||||
```
|
||||
I've created the implementation plan at:
|
||||
`thoughts/beads-{bead-id}/plan.md`
|
||||
|
||||
Please review it and let me know:
|
||||
- Are the phases properly scoped?
|
||||
- Are the success criteria specific enough?
|
||||
- Any technical details that need adjustment?
|
||||
- Missing edge cases or considerations?
|
||||
```
|
||||
|
||||
## Important Guidelines
|
||||
|
||||
1. **Be Skeptical**: Question vague requirements, identify potential issues early
|
||||
2. **Be Interactive**: Don't write the full plan in one shot, get buy-in at each step
|
||||
3. **Be Thorough**: Read all context files COMPLETELY, include specific file:line refs
|
||||
4. **Be Practical**: Focus on incremental, testable changes
|
||||
5. **No Open Questions**: If you have unresolved questions, STOP and ask
|
||||
|
||||
## Success Criteria Guidelines
|
||||
|
||||
Always separate into two categories:
|
||||
|
||||
**Automated Verification** (run by agents):
|
||||
- Commands: `make test`, `npm run lint`, etc.
|
||||
- File existence checks
|
||||
- Type checking
|
||||
|
||||
**Manual Verification** (requires human):
|
||||
- UI/UX functionality
|
||||
- Performance under real conditions
|
||||
- Edge cases hard to automate
|
||||
|
||||
**From Contribution Guidelines** (if CONTRIBUTING.md exists):
|
||||
- Include any testing requirements specified in guidelines
|
||||
- Include any code style/linting requirements
|
||||
- Include any documentation requirements
|
||||
- Reference the guideline: "Per CONTRIBUTING.md: {requirement}"
|
||||
|
||||
## Example Invocation
|
||||
|
||||
```
|
||||
User: /beads:plan nixos-configs-abc123
|
||||
Assistant: Creating implementation plan for bead nixos-configs-abc123...
|
||||
```
|
||||
222
home/roles/development/commands/beads_research.md
Normal file
@@ -0,0 +1,222 @@
|
||||
---
|
||||
description: Research a bead topic comprehensively and store findings in thoughts/
|
||||
model: opus
|
||||
---
|
||||
|
||||
# Beads Research
|
||||
|
||||
You are tasked with conducting comprehensive research for a bead issue. This skill integrates with the beads issue tracker and stores findings in the `thoughts/` directory.
|
||||
|
||||
## CRITICAL: YOUR ONLY JOB IS TO DOCUMENT AND EXPLAIN THE CODEBASE AS IT EXISTS TODAY
|
||||
- DO NOT suggest improvements or changes unless the user explicitly asks for them
|
||||
- DO NOT perform root cause analysis unless the user explicitly asks for them
|
||||
- DO NOT propose future enhancements unless the user explicitly asks for them
|
||||
- DO NOT critique the implementation or identify problems
|
||||
- ONLY describe what exists, where it exists, how it works, and how components interact
|
||||
- You are creating a technical map/documentation of the existing system
|
||||
|
||||
## Initial Setup
|
||||
|
||||
When this command is invoked:
|
||||
|
||||
1. **Parse the input for bead ID**:
|
||||
- If a bead ID is provided (e.g., `nixos-configs-abc123`), use it
|
||||
- If no bead ID provided, run `bd ready --type=research` to find research beads, or ask which bead to research
|
||||
|
||||
2. **Load bead context**:
|
||||
```bash
|
||||
bd show {bead-id}
|
||||
```
|
||||
- Read the bead description to understand the research question
|
||||
- Note any linked files or references in the bead
|
||||
|
||||
3. **Create artifact directory**:
|
||||
```bash
|
||||
mkdir -p thoughts/beads-{bead-id}
|
||||
```
|
||||
|
||||
4. **Respond with**:
|
||||
```
|
||||
Starting research for bead {bead-id}: {bead-title}
|
||||
|
||||
Research question: {extracted from bead description}
|
||||
|
||||
I'll analyze this thoroughly and store findings in thoughts/beads-{bead-id}/research.md
|
||||
```
|
||||
|
||||
## Research Process
|
||||
|
||||
### Step 1: Read any directly mentioned files
|
||||
- If the bead or user mentions specific files, read them FULLY first
|
||||
- Use the Read tool WITHOUT limit/offset parameters
|
||||
- Read these files yourself in the main context before spawning sub-tasks
|
||||
|
||||
### Step 1.5: Check for contribution guidelines
|
||||
|
||||
Before spawning sub-agents, check if the repository has contribution guidelines:
|
||||
|
||||
```bash
|
||||
for f in CONTRIBUTING.md .github/CONTRIBUTING.md docs/CONTRIBUTING.md; do
|
||||
if [ -f "$f" ]; then echo "Found: $f"; break; fi
|
||||
done
|
||||
```
|
||||
|
||||
If found, read the file and note key requirements. These should be included in the research document under a "## Contribution Guidelines" section if relevant to the research question.
|
||||
|
||||
### Step 2: Analyze and decompose the research question
|
||||
- Break down the query into composable research areas
|
||||
- Identify specific components, patterns, or concepts to investigate
|
||||
- Create a research plan using TodoWrite
|
||||
- Consider which directories, files, or patterns are relevant
|
||||
|
||||
### Step 3: Spawn parallel sub-agent tasks
|
||||
|
||||
Use specialized agents for research:
|
||||
|
||||
**For codebase research:**
|
||||
- **codebase-locator** - Find WHERE files and components live
|
||||
- **codebase-analyzer** - Understand HOW specific code works
|
||||
- **codebase-pattern-finder** - Find examples of existing patterns
|
||||
|
||||
**For thoughts directory:**
|
||||
- **thoughts-locator** - Discover what documents exist about the topic
|
||||
- **thoughts-analyzer** - Extract key insights from specific documents
|
||||
|
||||
**For web research (only if explicitly requested):**
|
||||
- **web-search-researcher** - External documentation and resources
|
||||
|
||||
Key principles:
|
||||
- Run multiple agents in parallel when searching for different things
|
||||
- Each agent knows its job - tell it what you're looking for, not HOW to search
|
||||
- Remind agents they are documenting, not evaluating
|
||||
|
||||
### Step 4: Synthesize findings
|
||||
|
||||
Wait for ALL sub-agents to complete, then:
|
||||
- Compile all results (codebase and thoughts findings)
|
||||
- Prioritize live codebase findings as primary source of truth
|
||||
- Connect findings across different components
|
||||
- Include specific file paths and line numbers
|
||||
- Highlight patterns, connections, and architectural decisions
|
||||
|
||||
### Step 5: Gather metadata
|
||||
|
||||
```bash
|
||||
# Git metadata
|
||||
git rev-parse HEAD # Current commit
|
||||
git branch --show-current # Current branch
|
||||
basename $(git rev-parse --show-toplevel) # Repo name
|
||||
date -Iseconds # Current timestamp
|
||||
```
|
||||
|
||||
### Step 6: Write research document
|
||||
|
||||
Write to `thoughts/beads-{bead-id}/research.md`:
|
||||
|
||||
```markdown
|
||||
---
|
||||
date: {ISO timestamp with timezone}
|
||||
bead_id: {bead-id}
|
||||
bead_title: "{bead title}"
|
||||
researcher: claude
|
||||
git_commit: {commit hash}
|
||||
branch: {branch name}
|
||||
repository: {repo name}
|
||||
status: complete
|
||||
---
|
||||
|
||||
# Research: {bead title}
|
||||
|
||||
**Bead**: {bead-id}
|
||||
**Date**: {timestamp}
|
||||
**Git Commit**: {commit hash}
|
||||
**Branch**: {branch name}
|
||||
|
||||
## Research Question
|
||||
{Original question from bead description}
|
||||
|
||||
## Summary
|
||||
{High-level documentation answering the research question}
|
||||
|
||||
## Detailed Findings
|
||||
|
||||
### {Component/Area 1}
|
||||
- Description of what exists (file.ext:line)
|
||||
- How it connects to other components
|
||||
- Current implementation details
|
||||
|
||||
### {Component/Area 2}
|
||||
...
|
||||
|
||||
## Code References
|
||||
- `path/to/file.py:123` - Description
|
||||
- `another/file.ts:45-67` - Description
|
||||
|
||||
## Architecture Documentation
|
||||
{Current patterns, conventions found in codebase}
|
||||
|
||||
## Contribution Guidelines
|
||||
{If CONTRIBUTING.md exists, summarize key requirements relevant to the research topic}
|
||||
{If no guidelines found, omit this section}
|
||||
|
||||
## Historical Context (from thoughts/)
|
||||
{Relevant insights from thoughts/ with references}
|
||||
|
||||
## Open Questions
|
||||
{Any areas needing further investigation}
|
||||
```
|
||||
|
||||
### Step 7: Update the bead
|
||||
|
||||
```bash
|
||||
# Add artifact link to bead notes
|
||||
bd update {bead-id} --notes="Research complete: thoughts/beads-{bead-id}/research.md"
|
||||
```
|
||||
|
||||
### Step 8: Autonomy decision
|
||||
|
||||
**For research beads (type=research):**
|
||||
- If research is complete and comprehensive, close the bead:
|
||||
```bash
|
||||
bd close {bead-id} --reason="Research complete. See thoughts/beads-{bead-id}/research.md"
|
||||
```
|
||||
- Present summary to user
|
||||
|
||||
**For other bead types:**
|
||||
- Do NOT close the bead
|
||||
- Present findings and ask how to proceed
|
||||
|
||||
### Step 9: Handle follow-up questions
|
||||
|
||||
If the user has follow-up questions:
|
||||
- Append to the same research document
|
||||
- Add a new section: `## Follow-up Research [{timestamp}]`
|
||||
- Update the bead notes with the new findings
|
||||
|
||||
## Important Guidelines
|
||||
|
||||
- Always use parallel Task agents to maximize efficiency
|
||||
- Always run fresh codebase research - never rely solely on existing documents
|
||||
- Focus on finding concrete file paths and line numbers
|
||||
- Research documents should be self-contained
|
||||
- Document cross-component connections
|
||||
- Include temporal context (when research was conducted)
|
||||
- Keep the main agent focused on synthesis, not deep file reading
|
||||
- **CRITICAL**: You and all sub-agents are documentarians, not evaluators
|
||||
- **REMEMBER**: Document what IS, not what SHOULD BE
|
||||
|
||||
## Example Invocation
|
||||
|
||||
```
|
||||
User: /beads:research nixos-configs-abc123
|
||||
Assistant: Starting research for bead nixos-configs-abc123: Investigate auth flow
|
||||
...
|
||||
```
|
||||
|
||||
Or without bead ID:
|
||||
```
|
||||
User: /beads:research
|
||||
Assistant: Let me check for research beads...
|
||||
[runs bd ready]
|
||||
Which bead would you like me to research?
|
||||
```
|
||||
387
home/roles/development/commands/beads_workflow.md
Normal file
@@ -0,0 +1,387 @@
|
||||
---
|
||||
description: Comprehensive guide for the beads + humanlayer integrated workflow
|
||||
---
|
||||
|
||||
# Beads Workflow Guide
|
||||
|
||||
This document describes the integrated workflow combining **beads** (issue tracking) with **humanlayer-style skills** (deep research, planning, implementation).
|
||||
|
||||
## Philosophy
|
||||
|
||||
### Two Systems, Complementary Purposes
|
||||
|
||||
| System | Purpose | Storage |
|
||||
|--------|---------|---------|
|
||||
| **Beads** | Track WHAT work exists | `.beads/` (git-synced) |
|
||||
| **Thoughts** | Store HOW to do the work | `thoughts/` (local or symlinked) |
|
||||
|
||||
### Autonomy Model
|
||||
|
||||
| Bead Type | Agent Autonomy | Checkpoint |
|
||||
|-----------|----------------|------------|
|
||||
| `research` | **Full** - agent closes when satisfied | None |
|
||||
| `feature`, `task`, `bug` | **Checkpointed** - pause for validation | Per-plan |
|
||||
|
||||
**Key insight**: Research produces artifacts. Implementation produces commits. Commits are the review boundary.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project/
|
||||
├── .beads/ # Beads database (git-synced)
|
||||
│ ├── beads.db
|
||||
│ ├── config.yaml
|
||||
│ └── issues.jsonl
|
||||
├── thoughts/ # Artifacts (local or symlink)
|
||||
│ ├── beads-{id}/ # Per-bead artifacts
|
||||
│ │ ├── research.md
|
||||
│ │ ├── plan.md
|
||||
│ │ └── plan-v1.md # Iteration history
|
||||
│ └── shared/ # Legacy/non-bead artifacts
|
||||
│ ├── research/
|
||||
│ └── plans/
|
||||
└── home/roles/development/skills/ # Skill definitions
|
||||
├── beads_research.md
|
||||
├── beads_plan.md
|
||||
├── beads_implement.md
|
||||
└── beads_iterate.md
|
||||
```
|
||||
|
||||
## When to Use What
|
||||
|
||||
### Use Beads When:
|
||||
- Work spans multiple sessions
|
||||
- Work has dependencies or blockers
|
||||
- You need to track status across interruptions
|
||||
- Multiple related tasks need coordination
|
||||
- Context recovery after compaction matters
|
||||
|
||||
### Use TodoWrite When:
|
||||
- Single-session execution tracking
|
||||
- Breaking down work within a session
|
||||
- Tracking progress on a single bead
|
||||
|
||||
### Use Both Together:
|
||||
- Beads track the overall work items
|
||||
- TodoWrite tracks progress within a session
|
||||
- Example: Bead for "Implement auth", TodoWrite for each file being edited
|
||||
|
||||
## Workflow Patterns
|
||||
|
||||
### Pattern 1: Research-First Approach
|
||||
|
||||
```
|
||||
1. Create research bead
|
||||
bd create --title="Research auth patterns" --type=research --priority=1
|
||||
|
||||
2. Run research
|
||||
/beads:research {bead-id}
|
||||
→ Agent researches, writes to thoughts/beads-{id}/research.md
|
||||
→ Agent closes bead when satisfied
|
||||
|
||||
3. Create implementation bead
|
||||
bd create --title="Implement auth" --type=feature --priority=1
|
||||
|
||||
4. Plan the implementation
|
||||
/beads:plan {bead-id}
|
||||
→ Agent reads prior research, creates plan
|
||||
→ Plan saved to thoughts/beads-{id}/plan.md
|
||||
|
||||
5. Implement
|
||||
/beads:implement {bead-id}
|
||||
→ Agent follows plan, pauses for manual verification
|
||||
→ You validate, agent closes bead
|
||||
```
|
||||
|
||||
### Pattern 2: Direct Implementation
|
||||
|
||||
For well-understood tasks without research:
|
||||
|
||||
```
|
||||
1. Create bead
|
||||
bd create --title="Fix login bug" --type=bug --priority=0
|
||||
|
||||
2. Plan and implement
|
||||
/beads:plan {bead-id}
|
||||
→ Quick planning based on bead description
|
||||
|
||||
/beads:implement {bead-id}
|
||||
→ Follow plan, pause at checkpoint
|
||||
```
|
||||
|
||||
### Pattern 3: Iterative Planning
|
||||
|
||||
When requirements evolve:
|
||||
|
||||
```
|
||||
1. Initial plan
|
||||
/beads:plan {bead-id}
|
||||
|
||||
2. Iterate based on feedback
|
||||
/beads:iterate {bead-id} - add error handling phase
|
||||
|
||||
3. Iterate again if needed
|
||||
/beads:iterate {bead-id} - split phase 2 into backend/frontend
|
||||
|
||||
4. Implement when plan is solid
|
||||
/beads:implement {bead-id}
|
||||
```
|
||||
|
||||
### Pattern 4: Parallel Work
|
||||
|
||||
Using parallel_beads skill for multiple independent tasks:
|
||||
|
||||
```
|
||||
1. Check what's ready
|
||||
bd ready
|
||||
|
||||
2. Select multiple beads
|
||||
/parallel_beads
|
||||
→ Select beads to work on
|
||||
→ Each gets worktree, PR, review
|
||||
|
||||
3. Reconcile after PRs merge
|
||||
/reconcile_beads
|
||||
```
|
||||
|
||||
## Skills Reference
|
||||
|
||||
### /beads:research {bead-id}
|
||||
- Conducts comprehensive codebase research
|
||||
- Uses parallel sub-agents for efficiency
|
||||
- Outputs to `thoughts/beads-{id}/research.md`
|
||||
- **Autonomy**: Can close research beads automatically
|
||||
|
||||
### /beads:plan {bead-id}
|
||||
- Creates detailed implementation plans
|
||||
- Interactive process with checkpoints
|
||||
- Outputs to `thoughts/beads-{id}/plan.md`
|
||||
- Can create dependent implementation beads
|
||||
|
||||
### /beads:implement {bead-id}
|
||||
- Follows plans from thoughts/
|
||||
- Updates plan checkboxes for resumability
|
||||
- **Checkpoint**: Pauses after plan completion for manual verification
|
||||
- Only closes bead after human confirms
|
||||
|
||||
### /beads:iterate {bead-id}
|
||||
- Updates existing plans based on feedback
|
||||
- Preserves plan structure while making targeted changes
|
||||
- Saves iteration history as `plan-v{N}.md`
|
||||
|
||||
### /parallel_beads
|
||||
- Orchestrates parallel bead processing
|
||||
- Creates worktrees, PRs, reviews for multiple beads
|
||||
- Good for batching independent work
|
||||
|
||||
### /reconcile_beads
|
||||
- Closes beads whose PRs have merged
|
||||
- Run after merging PRs to keep beads in sync
|
||||
|
||||
## Session Protocols
|
||||
|
||||
### Starting a Session
|
||||
|
||||
```bash
|
||||
# Check what's available
|
||||
bd ready
|
||||
|
||||
# Pick work and start
|
||||
bd update {bead-id} --status=in_progress
|
||||
```
|
||||
|
||||
### Ending a Session
|
||||
|
||||
```bash
|
||||
# Always run this checklist:
|
||||
[ ] git status # Check changes
|
||||
[ ] git add <files> # Stage code changes
|
||||
[ ] bd sync # Sync beads
|
||||
[ ] git commit -m "..." # Commit code
|
||||
[ ] git push # Push to remote
|
||||
```
|
||||
|
||||
### Resuming Work
|
||||
|
||||
```bash
|
||||
# Find in-progress work
|
||||
bd list --status=in_progress
|
||||
|
||||
# Check bead notes for context
|
||||
bd show {bead-id}
|
||||
|
||||
# Check for partial plan progress
|
||||
cat thoughts/beads-{id}/plan.md | grep "\[x\]"
|
||||
```
|
||||
|
||||
## Thoughts Directory Patterns
|
||||
|
||||
### For Work Repos (via symlink)
|
||||
```
|
||||
project/thoughts → ~/thoughts/repos/{repo-name}/
|
||||
```
|
||||
- Syncs via codelayer to work remote
|
||||
- Shared across projects on same machine
|
||||
|
||||
### For Personal Repos (local)
|
||||
```
|
||||
project/thoughts/ # Regular directory, not symlink
|
||||
```
|
||||
- Stays local to project
|
||||
- Committed with project or gitignored
|
||||
|
||||
### Determining Which Pattern
|
||||
```bash
|
||||
# Check if thoughts is a symlink
|
||||
ls -la thoughts
|
||||
|
||||
# If symlink, it points to ~/thoughts/repos/{repo}/
|
||||
# If directory, it's local to this project
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### 1. Bead Descriptions Matter
|
||||
Write clear descriptions - they're the input for research and planning:
|
||||
```bash
|
||||
bd create --title="Implement user preferences" --type=feature \
|
||||
--description="Add user preferences storage and UI.
|
||||
|
||||
Requirements:
|
||||
- Store preferences in SQLite
|
||||
- Expose via REST API
|
||||
- Add settings page in UI
|
||||
|
||||
See related: thoughts/shared/research/preferences-patterns.md"
|
||||
```
|
||||
|
||||
### 2. Link Artifacts in Beads
|
||||
Always update bead notes with artifact locations:
|
||||
```bash
|
||||
bd update {id} --notes="Research: thoughts/beads-{id}/research.md
|
||||
Plan: thoughts/beads-{id}/plan.md"
|
||||
```
|
||||
|
||||
### 3. Use Dependencies
|
||||
Structure work with dependencies:
|
||||
```bash
|
||||
# Research blocks planning
|
||||
bd dep add {plan-bead} {research-bead}
|
||||
|
||||
# Planning blocks implementation
|
||||
bd dep add {impl-bead} {plan-bead}
|
||||
```
|
||||
|
||||
### 4. Trust the Checkpoint Model
|
||||
- Research beads: Let agent close them
|
||||
- Implementation beads: Always validate before closing
|
||||
- If in doubt, err on the side of checkpoints
|
||||
|
||||
### 5. Keep Plans Updated
|
||||
- Check off completed items as you go
|
||||
- Update notes with progress
|
||||
- This enables seamless resume across sessions
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "What bead should I work on?"
|
||||
```bash
|
||||
bd ready # Shows unblocked work
|
||||
```
|
||||
|
||||
### "Where did the research go?"
|
||||
```bash
|
||||
ls thoughts/beads-{id}/
|
||||
bd show {id} # Check notes for artifact links
|
||||
```
|
||||
|
||||
### "Plan doesn't match reality"
|
||||
```bash
|
||||
/beads:iterate {id} # Update plan based on findings
|
||||
```
|
||||
|
||||
### "Session ended mid-implementation"
|
||||
```bash
|
||||
bd show {id} # Check notes for progress
|
||||
cat thoughts/beads-{id}/plan.md | grep "\[x\]" # See completed items
|
||||
/beads:implement {id} # Resume - will pick up from last checkpoint
|
||||
```
|
||||
|
||||
### "Bead is blocked"
|
||||
```bash
|
||||
bd show {id} # See what's blocking
|
||||
bd blocked # See all blocked beads
|
||||
```
|
||||
|
||||
## Migration Notes
|
||||
|
||||
### From Pure Humanlayer to Beads+Humanlayer
|
||||
|
||||
Old pattern:
|
||||
```
|
||||
thoughts/shared/research/2025-01-01-topic.md
|
||||
thoughts/shared/plans/2025-01-01-feature.md
|
||||
```
|
||||
|
||||
New pattern:
|
||||
```
|
||||
thoughts/beads-{id}/research.md
|
||||
thoughts/beads-{id}/plan.md
|
||||
```
|
||||
|
||||
The `shared/` structure still works for non-bead artifacts, but prefer per-bead directories for tracked work.
|
||||
|
||||
### Existing Content
|
||||
- Keep existing `thoughts/shared/` content
|
||||
- New bead-tracked work uses `thoughts/beads-{id}/`
|
||||
- Reference old research from bead descriptions when relevant
|
||||
|
||||
## Design Decisions
|
||||
|
||||
### Phase Tracking: Artifacts vs Statuses
|
||||
|
||||
**Current approach**: Skills infer workflow phase from artifact presence:
|
||||
- Has `research.md` → research done
|
||||
- Has `plan.md` → planning done
|
||||
- No artifacts → needs research/planning
|
||||
|
||||
**Alternative considered**: Explicit phase statuses (`needs_research`, `needs_plan`, `implementing`, etc.)
|
||||
|
||||
**Why artifacts win**:
|
||||
1. **Single source of truth** - Status can't drift from reality
|
||||
2. **Less state to maintain** - No need to update status when creating artifacts
|
||||
3. **Works across repos** - No custom status config needed
|
||||
4. **Skills already check artifacts** - Natural fit with existing behavior
|
||||
|
||||
**When explicit statuses would help**:
|
||||
- Pipeline visualization (e.g., `bd list --status=needs_plan`)
|
||||
- Agent self-selection by phase
|
||||
- Team coordination dashboards
|
||||
|
||||
**Recommendation**: Keep artifact-inference as primary mechanism. If pipeline visibility becomes important, consider adding statuses that skills auto-set when creating artifacts (advisory, not enforced).
|
||||
|
||||
### One Bead Per Feature (Default)
|
||||
|
||||
**Current approach**: File one bead per logical feature. Skills handle phases internally.
|
||||
|
||||
**Alternative considered**: Separate beads for research → planning → implementation, linked by dependencies.
|
||||
|
||||
**Why single bead wins for most work**:
|
||||
1. **Lower friction** - Quick idea dump without filing 3 tickets
|
||||
2. **Simpler tracking** - One status to check
|
||||
3. **Natural grouping** - Artifacts stay together in `thoughts/beads-{id}/`
|
||||
|
||||
**When to split into multiple beads**:
|
||||
- Research reveals the work should be multiple features
|
||||
- Different phases need different assignees
|
||||
- Explicit dependency tracking matters (e.g., "auth must ship before payments")
|
||||
|
||||
**The discovered-work pattern**: Start with one bead. If research reveals split work, file additional beads with dependencies. Skills guide this naturally.
|
||||
|
||||
### Plan Requirements by Type
|
||||
|
||||
**Bug fixes** (`type=bug`): Can proceed without plans - usually well-scoped from bug report.
|
||||
|
||||
**Features/tasks** (`type=feature`, `type=task`): Should have plans - helps ensure design is sound before implementation.
|
||||
|
||||
This is advisory, not enforced. Skills warn but allow override for simple changes.
|
||||
472
home/roles/development/commands/gitea_pr_review.md
Normal file
@@ -0,0 +1,472 @@
|
||||
---
|
||||
description: Address Gitea/Forgejo PR review comments with code changes
|
||||
---
|
||||
|
||||
# Gitea PR Review
|
||||
|
||||
You are tasked with **addressing** PR review comments by making code changes, then summarizing what was done. This skill drives PR progress, not just conversation.
|
||||
|
||||
## Philosophy
|
||||
|
||||
**Comments are work items, not conversation starters.**
|
||||
|
||||
When a reviewer leaves a comment, they're identifying something that needs attention. This skill:
|
||||
1. Categorizes comments by actionability
|
||||
2. Makes code changes to address actionable comments
|
||||
3. Commits and pushes those changes
|
||||
4. Posts a single summary comment describing what was done
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `tea` CLI configured with a Gitea/Forgejo instance
|
||||
- Access token from tea config: `~/.config/tea/config.yml`
|
||||
- Repository must be a Gitea/Forgejo remote (not GitHub)
|
||||
- **Nix users**: All tools available via nixpkgs (`nix run nixpkgs#tea`)
|
||||
|
||||
## Initial Setup
|
||||
|
||||
When this command is invoked:
|
||||
|
||||
1. **Parse the input for PR number**:
|
||||
- If a PR number is provided as argument, use it
|
||||
- If no PR number, detect from current branch (see PR Detection section)
|
||||
|
||||
2. **Verify required tools are available**:
|
||||
```bash
|
||||
which tea
|
||||
```
|
||||
|
||||
If tea is missing:
|
||||
```
|
||||
Error: `tea` CLI not found.
|
||||
|
||||
Please install:
|
||||
- Nix: nix run nixpkgs#tea
|
||||
- Other: https://gitea.com/gitea/tea
|
||||
```
|
||||
**STOP** if tea is missing.
|
||||
|
||||
3. **Extract configuration from tea config**:
|
||||
```bash
|
||||
# Read tea config (it's YAML but simple enough to grep)
|
||||
TEA_CONFIG="$HOME/.config/tea/config.yml"
|
||||
GITEA_URL=$(grep -A1 'logins:' "$TEA_CONFIG" | grep 'url:' | head -1 | sed 's/.*url: //')
|
||||
TOKEN=$(grep -A5 'logins:' "$TEA_CONFIG" | grep 'token:' | head -1 | sed 's/.*token: //')
|
||||
```
|
||||
|
||||
If config is missing or invalid:
|
||||
```
|
||||
Error: Could not read tea config at ~/.config/tea/config.yml
|
||||
|
||||
Please ensure `tea` is installed and configured:
|
||||
1. Install tea
|
||||
2. Log in: tea login add --url https://your-gitea-instance --token YOUR_TOKEN
|
||||
```
|
||||
**STOP** if config is invalid.
|
||||
|
||||
4. **Detect repository info from git remote**:
|
||||
```bash
|
||||
REMOTE_URL=$(git remote get-url origin)
|
||||
# Parse owner and repo from URL (handles both SSH and HTTPS)
|
||||
OWNER=$(echo "$REMOTE_URL" | sed -E 's#.*[:/]([^/]+)/[^/]+\.git$#\1#')
|
||||
REPO=$(echo "$REMOTE_URL" | sed -E 's#.*/([^/]+)\.git$#\1#')
|
||||
```
|
||||
|
||||
5. **Ensure we're on the PR branch**:
|
||||
```bash
|
||||
CURRENT_BRANCH=$(git branch --show-current)
|
||||
# Verify this branch corresponds to the PR
|
||||
```
|
||||
|
||||
6. **Respond with**:
|
||||
```
|
||||
Addressing PR review comments for PR #{PR_NUMBER}...
|
||||
|
||||
Repository: {OWNER}/{REPO}
|
||||
Branch: {CURRENT_BRANCH}
|
||||
Gitea URL: {GITEA_URL}
|
||||
```
|
||||
|
||||
## PR Detection
|
||||
|
||||
If no PR number is provided, detect from the current branch:
|
||||
|
||||
```bash
|
||||
CURRENT_BRANCH=$(git branch --show-current)
|
||||
tea pr list --fields index,head --output simple | grep "$CURRENT_BRANCH"
|
||||
```
|
||||
|
||||
If no PR exists for the current branch, use `AskUserQuestion`:
|
||||
|
||||
```
|
||||
No PR found for branch '{CURRENT_BRANCH}'.
|
||||
|
||||
Would you like to:
|
||||
1. Enter a PR number manually
|
||||
2. Cancel
|
||||
```
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Fetch and Parse Comments
|
||||
|
||||
Fetch all reviews and their comments:
|
||||
|
||||
```bash
|
||||
# Fetch reviews (filter out dismissed reviews)
|
||||
curl -s -H "Authorization: token $TOKEN" \
|
||||
"$GITEA_URL/api/v1/repos/$OWNER/$REPO/pulls/$PR_NUMBER/reviews" \
|
||||
| jq '[.[] | select(.dismissed != true)]'
|
||||
|
||||
# For each review, fetch comments
|
||||
curl -s -H "Authorization: token $TOKEN" \
|
||||
"$GITEA_URL/api/v1/repos/$OWNER/$REPO/pulls/$PR_NUMBER/reviews/$REVIEW_ID/comments"
|
||||
```
|
||||
|
||||
**Filter resolved comments**: When processing comments, skip any that have been marked as resolved. Check the `resolver` field in the comment response - if it's not null, the comment has been resolved and should be skipped.
|
||||
|
||||
```bash
|
||||
# Example: Filter to only unresolved comments
|
||||
jq '[.[] | select(.resolver == null)]'
|
||||
```
|
||||
|
||||
If no reviews found or all comments are resolved:
|
||||
```
|
||||
No unresolved reviews found for PR #{PR_NUMBER}.
|
||||
Nothing to address.
|
||||
```
|
||||
**STOP** here.
|
||||
|
||||
### Step 2: Categorize Comments
|
||||
|
||||
For each comment, categorize it as one of:
|
||||
|
||||
| Category | Description | Action |
|
||||
|----------|-------------|--------|
|
||||
| **actionable** | Requests a code change, addition, or fix | Launch subagent to make change |
|
||||
| **question** | Asks for clarification or explanation | Include answer in summary |
|
||||
| **acknowledged** | FYI, self-resolved, or "no action needed" noted | Note in summary |
|
||||
| **blocked** | Requires external input or is out of scope | Flag for user |
|
||||
|
||||
**Categorization heuristics**:
|
||||
- Contains "add", "change", "fix", "update", "consider adding", "should be" → **actionable**
|
||||
- Contains "?" or "why", "how", "what" → **question**
|
||||
- Contains "no need to update", "will be separate", "acknowledged" → **acknowledged**
|
||||
- Contains "discuss", "later", "out of scope", "blocked by" → **blocked**
|
||||
|
||||
Display the categorization:
|
||||
```
|
||||
## Comment Analysis
|
||||
|
||||
### Actionable (will make changes):
|
||||
1. {file}:{line} - "{comment_summary}" → Will add nix note to prerequisites
|
||||
|
||||
### Questions (will answer in summary):
|
||||
2. {file}:{line} - "{comment_summary}" → Explain CI token approach
|
||||
|
||||
### Acknowledged (no action needed):
|
||||
3. {file}:{line} - "{comment_summary}" → Reviewer noted separate skill
|
||||
|
||||
### Blocked (needs input):
|
||||
(none)
|
||||
```
|
||||
|
||||
### Step 3: User Confirmation
|
||||
|
||||
Use `AskUserQuestion` to confirm the plan:
|
||||
|
||||
```
|
||||
I've categorized {N} comments. My plan:
|
||||
|
||||
**Will make changes for:**
|
||||
- {file}:{line}: {planned_change}
|
||||
|
||||
**Will explain in summary:**
|
||||
- {file}:{line}: {planned_explanation}
|
||||
|
||||
**No action needed:**
|
||||
- {file}:{line}: {reason}
|
||||
|
||||
Proceed with this plan?
|
||||
```
|
||||
|
||||
Options:
|
||||
1. **Proceed** - Execute the plan
|
||||
2. **Modify** - Let user adjust categorization
|
||||
3. **Cancel** - Exit without changes
|
||||
|
||||
### Step 4: Address Actionable Comments (Parallel Subagents)
|
||||
|
||||
For each actionable comment, launch a subagent using the Task tool:
|
||||
|
||||
```
|
||||
Launch Task subagent with:
|
||||
- subagent_type: "general-purpose"
|
||||
- prompt: |
|
||||
You are addressing a PR review comment. Make the requested change and nothing else.
|
||||
|
||||
**File**: {file_path}
|
||||
**Line**: {line_number}
|
||||
**Comment**: {comment_body}
|
||||
**Diff context**:
|
||||
```
|
||||
{diff_hunk}
|
||||
```
|
||||
|
||||
Instructions:
|
||||
1. Read the file to understand context
|
||||
2. Make the minimal change to address the comment
|
||||
3. Do NOT commit - just make the edit
|
||||
4. Report what you changed
|
||||
|
||||
Be precise. Only change what's needed to address this specific comment.
|
||||
```
|
||||
|
||||
**Important**: Launch actionable comment subagents in parallel when they touch different files. For comments on the same file, run sequentially to avoid conflicts.
|
||||
|
||||
Wait for all subagents to complete and collect their results.
|
||||
|
||||
### Step 5: Commit and Push
|
||||
|
||||
After all subagents complete:
|
||||
|
||||
1. **Stage changes**:
|
||||
```bash
|
||||
git add -A
|
||||
```
|
||||
|
||||
2. **Create commit with summary**:
|
||||
```bash
|
||||
git commit -m "Address PR review comments
|
||||
|
||||
Changes made:
|
||||
- {file1}: {change_summary}
|
||||
- {file2}: {change_summary}
|
||||
|
||||
Addresses comments from review by {reviewer}"
|
||||
```
|
||||
|
||||
3. **Push to remote**:
|
||||
```bash
|
||||
git push
|
||||
```
|
||||
|
||||
### Step 6: Post Summary Comment
|
||||
|
||||
Post a single comment summarizing all actions taken:
|
||||
|
||||
```bash
|
||||
tea comment $PR_NUMBER "$(cat <<'EOF'
|
||||
## Review Comments Addressed
|
||||
|
||||
cc @{reviewer1} @{reviewer2}
|
||||
|
||||
**Changes made** (commit {SHORT_SHA}):
|
||||
- `{file1}:{line}`: {what_was_changed}
|
||||
- `{file2}:{line}`: {what_was_changed}
|
||||
|
||||
**Responses to questions**:
|
||||
- `{file3}:{line}`: {answer_to_question}
|
||||
|
||||
**Acknowledged** (no action needed):
|
||||
- `{file4}:{line}`: {reason_no_action}
|
||||
|
||||
---
|
||||
*Automated response via /gitea_pr_review*
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
### Step 7: Final Summary
|
||||
|
||||
Display to user:
|
||||
|
||||
```
|
||||
## PR Review Complete
|
||||
|
||||
**Commit**: {SHA}
|
||||
**Changes**: {N} files modified
|
||||
|
||||
### Actions Taken:
|
||||
- [x] {file1}:{line} - Added nix prerequisite note
|
||||
- [x] {file2}:{line} - Explained CI approach in comment
|
||||
- [ ] {file3}:{line} - Acknowledged (separate skill)
|
||||
|
||||
**Reviewers tagged**: @{reviewer1}, @{reviewer2}
|
||||
**Comment posted**: {comment_url}
|
||||
|
||||
PR URL: {GITEA_URL}/{OWNER}/{REPO}/pulls/{PR_NUMBER}
|
||||
```
|
||||
|
||||
**Note**: When posting the summary comment, tag all reviewers who left comments so they receive notifications about the changes.
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Subagent failed to make change
|
||||
|
||||
If a subagent fails:
|
||||
```
|
||||
Warning: Could not address comment on {file}:{line}
|
||||
|
||||
Reason: {error}
|
||||
|
||||
Options:
|
||||
1. Skip this comment and continue
|
||||
2. Retry with manual guidance
|
||||
3. Abort all changes
|
||||
```
|
||||
|
||||
### Push failed
|
||||
|
||||
```
|
||||
Error pushing changes: {error}
|
||||
|
||||
Your changes are committed locally. You may need to:
|
||||
1. Pull and resolve conflicts: git pull --rebase
|
||||
2. Push again: git push
|
||||
```
|
||||
|
||||
### No actionable comments
|
||||
|
||||
If all comments are questions/acknowledged:
|
||||
```
|
||||
No code changes needed.
|
||||
|
||||
All comments are either questions or acknowledged items.
|
||||
Posting summary comment with explanations...
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Endpoints Used
|
||||
|
||||
| Action | Method | Endpoint |
|
||||
|--------|--------|----------|
|
||||
| List reviews | GET | `/api/v1/repos/{owner}/{repo}/pulls/{index}/reviews` |
|
||||
| Get review comments | GET | `/api/v1/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments` |
|
||||
| Create issue comment | POST | via `tea comment` |
|
||||
|
||||
### Review States
|
||||
|
||||
- `PENDING` - Draft review not yet submitted
|
||||
- `COMMENT` - General comment without approval/rejection
|
||||
- `APPROVE` - Approving the changes
|
||||
- `REQUEST_CHANGES` - Requesting changes before merge
|
||||
|
||||
## Shell Command Patterns
|
||||
|
||||
Claude Code's bash execution has quirks. Use these patterns for reliability:
|
||||
|
||||
### curl requests
|
||||
|
||||
**DO** - Use single quotes for URL and header separately:
|
||||
```bash
|
||||
curl -s 'https://git.example.com/api/v1/repos/owner/repo/pulls/1/reviews' \
|
||||
-H 'Authorization: token YOUR_TOKEN_HERE' | jq .
|
||||
```
|
||||
|
||||
**DON'T** - Variable expansion in `-H` flag often fails:
|
||||
```bash
|
||||
# This may fail with "blank argument" errors
|
||||
curl -s -H "Authorization: token $TOKEN" "$URL"
|
||||
```
|
||||
|
||||
### Iterating over reviews
|
||||
|
||||
**DO** - Run separate commands for each review ID:
|
||||
```bash
|
||||
echo "=== Review 4 ===" && curl -s 'URL/reviews/4/comments' -H 'Authorization: token ...' | jq .
|
||||
echo "=== Review 5 ===" && curl -s 'URL/reviews/5/comments' -H 'Authorization: token ...' | jq .
|
||||
```
|
||||
|
||||
**DON'T** - For loops with multiline bodies often fail:
|
||||
```bash
|
||||
# This may cause syntax errors
|
||||
for id in 4 5 6; do
|
||||
curl -s "URL/reviews/$id/comments"
|
||||
done
|
||||
```
|
||||
|
||||
### tea comment
|
||||
|
||||
**DO** - Use single-quoted string for comment body:
|
||||
```bash
|
||||
tea comment 26 '## Summary
|
||||
|
||||
Changes made:
|
||||
- Item 1
|
||||
- Item 2'
|
||||
```
|
||||
|
||||
**DON'T** - Heredocs may hang or timeout:
|
||||
```bash
|
||||
# This may hang indefinitely
|
||||
tea comment 26 "$(cat <<'EOF'
|
||||
...
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
1. **Thread replies**: Gitea API doesn't support inline thread replies. We post a single summary comment instead.
|
||||
|
||||
2. **Complex changes**: For comments requiring significant refactoring, the subagent may need guidance. The skill will flag these as "blocked" for user input.
|
||||
|
||||
3. **Merge conflicts**: If the branch is behind, you may need to rebase before changes can be pushed.
|
||||
|
||||
## Example Session
|
||||
|
||||
```
|
||||
User: /gitea_pr_review 26
|
||||
Assistant: Addressing PR review comments for PR #26...
|
||||
|
||||
Repository: johno/nixos-configs
|
||||
Branch: bead/nixos-configs-vru
|
||||
Gitea URL: https://git.johnogle.info
|
||||
|
||||
## Comment Analysis
|
||||
|
||||
### Actionable (will make changes):
|
||||
1. gitea_pr_review.md:12 - "could we indicate nix+nixpkgs satisfies this?"
|
||||
→ Will add note that nix users can get tools via nixpkgs
|
||||
|
||||
### Questions (will answer in summary):
|
||||
(none)
|
||||
|
||||
### Acknowledged (no action needed):
|
||||
2. gitea_pr_review.md:50 - "we eventually want to run this in CI..."
|
||||
→ Reviewer noted this will be a separate skill
|
||||
|
||||
Proceed with this plan? [Proceed]
|
||||
|
||||
Launching subagent to address comment 1...
|
||||
[Subagent completes edit]
|
||||
|
||||
Committing changes...
|
||||
[abc1234] Address PR review comments
|
||||
|
||||
Pushing to remote...
|
||||
Done.
|
||||
|
||||
Posting summary comment...
|
||||
|
||||
## PR Review Complete
|
||||
|
||||
**Commit**: abc1234
|
||||
**Changes**: 1 file modified
|
||||
|
||||
### Actions Taken:
|
||||
- [x] gitea_pr_review.md:12 - Added nix prerequisite note
|
||||
- [ ] gitea_pr_review.md:50 - Acknowledged (separate skill)
|
||||
|
||||
**Comment posted**: https://git.johnogle.info/.../pulls/26#issuecomment-XXX
|
||||
|
||||
PR URL: https://git.johnogle.info/johno/nixos-configs/pulls/26
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `tea` CLI: https://gitea.com/gitea/tea
|
||||
- Gitea API: https://docs.gitea.com/api/
|
||||
- `/beads_workflow` for full development workflow
|
||||
130
home/roles/development/commands/import_gitea_issues.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
description: Import open Gitea issues as beads, skipping already-imported ones
|
||||
---
|
||||
|
||||
# Import Gitea Issues as Beads
|
||||
|
||||
This skill imports open Gitea issues as beads, checking for duplicates to avoid re-importing already tracked issues.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `tea` CLI must be installed and configured for the repository
|
||||
- `bd` (beads) CLI must be installed
|
||||
- Must be in a git repository with a Gitea/Forgejo remote
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Get open Gitea issues
|
||||
|
||||
List all open issues using `tea`:
|
||||
|
||||
```bash
|
||||
tea issues
|
||||
```
|
||||
|
||||
This returns a table with columns: INDEX, TITLE, LABELS, MILESTONE
|
||||
|
||||
### Step 2: Get existing beads
|
||||
|
||||
List all current beads to check what's already imported:
|
||||
|
||||
```bash
|
||||
bd list
|
||||
```
|
||||
|
||||
Also check bead notes for issue URLs to identify imports:
|
||||
|
||||
```bash
|
||||
bd list --json | jq -r '.[] | select(.notes != null) | .notes' | grep -oP 'issues/\K\d+'
|
||||
```
|
||||
|
||||
### Step 3: Check for already-linked PRs
|
||||
|
||||
Check if any open PRs reference beads (skip these issues as they're being worked on):
|
||||
|
||||
```bash
|
||||
tea pr list
|
||||
```
|
||||
|
||||
Look for PRs with:
|
||||
- Bead ID in title: `[nixos-configs-xxx]`
|
||||
- Bead reference in body: `Implements bead:` or `Bead ID:`
|
||||
|
||||
### Step 4: For each untracked issue, create a bead
|
||||
|
||||
For each issue not already tracked:
|
||||
|
||||
1. **Get full issue details**:
|
||||
```bash
|
||||
tea issue [ISSUE_NUMBER]
|
||||
```
|
||||
|
||||
2. **Determine bead type** based on issue content:
|
||||
- "bug" - if issue mentions bug, error, broken, fix, crash
|
||||
- "feature" - if issue mentions feature, add, new, enhancement
|
||||
- "task" - default for other issues
|
||||
|
||||
3. **Create the bead**:
|
||||
```bash
|
||||
bd add "[ISSUE_TITLE]" \
|
||||
--type=[TYPE] \
|
||||
--priority=P2 \
|
||||
--notes="Gitea issue: [ISSUE_URL]
|
||||
|
||||
Original issue description:
|
||||
[ISSUE_BODY]"
|
||||
```
|
||||
|
||||
Note: The `--notes` flag accepts multi-line content.
|
||||
|
||||
### Step 5: Report results
|
||||
|
||||
Present a summary:
|
||||
|
||||
```
|
||||
## Gitea Issues Import Summary
|
||||
|
||||
### Imported as Beads
|
||||
| Issue | Title | Bead ID | Type |
|
||||
|-------|-------|---------|------|
|
||||
| #5 | Add dark mode | nixos-configs-abc | feature |
|
||||
| #3 | Config broken on reboot | nixos-configs-def | bug |
|
||||
|
||||
### Skipped (Already Tracked)
|
||||
| Issue | Title | Reason |
|
||||
|-------|-------|--------|
|
||||
| #4 | Update flake | Existing bead: nixos-configs-xyz |
|
||||
| #2 | Refactor roles | PR #7 references bead |
|
||||
|
||||
### Skipped (Other)
|
||||
| Issue | Title | Reason |
|
||||
|-------|-------|--------|
|
||||
| #1 | Discussion: future plans | No actionable work |
|
||||
```
|
||||
|
||||
## Type Detection Heuristics
|
||||
|
||||
Keywords to detect issue type:
|
||||
|
||||
**Bug indicators** (case-insensitive):
|
||||
- bug, error, broken, fix, crash, fail, issue, problem, wrong, not working
|
||||
|
||||
**Feature indicators** (case-insensitive):
|
||||
- feature, add, new, enhancement, implement, support, request, want, would be nice
|
||||
|
||||
**Task** (default):
|
||||
- Anything not matching bug or feature patterns
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **tea not configured**: Report error and exit
|
||||
- **bd not available**: Report error and exit
|
||||
- **Issue already has bead**: Skip and report in summary
|
||||
- **Issue is a PR**: Skip (tea shows PRs and issues separately)
|
||||
|
||||
## Notes
|
||||
|
||||
- Default priority is P2; adjust manually after import if needed
|
||||
- Issue labels from Gitea are not automatically mapped to bead tags
|
||||
- Run this periodically to catch new issues
|
||||
- After import, use `bd ready` to see which beads can be worked on
|
||||
409
home/roles/development/commands/parallel_beads.md
Normal file
@@ -0,0 +1,409 @@
|
||||
---
|
||||
description: Orchestrate parallel bead processing with worktrees, PRs, and reviews
|
||||
---
|
||||
|
||||
# Parallel Beads Workflow
|
||||
|
||||
This skill orchestrates parallel bead processing using subagents. Each bead gets its own worktree, implementation, PR, and review.
|
||||
|
||||
## Phase 1: Selection
|
||||
|
||||
1. **Get ready beads**: Run `bd ready` to list all beads with no blockers
|
||||
|
||||
2. **Filter by plan readiness**:
|
||||
For each ready bead, check if it's ready for batch implementation:
|
||||
- **Has plan** (`thoughts/beads-{id}/plan.md` exists): Include
|
||||
- **type=bug** without plan: Include (simple bugs can implement directly)
|
||||
- **type=feature/task** without plan: Exclude with warning
|
||||
|
||||
```bash
|
||||
# Check for plan existence
|
||||
ls thoughts/beads-{bead-id}/plan.md 2>/dev/null
|
||||
```
|
||||
|
||||
3. **Report skipped beads**:
|
||||
If any beads were skipped, inform the user:
|
||||
```
|
||||
Skipped beads (no plan):
|
||||
- {bead-id}: {title} (type: feature) - Run /beads_plan {bead-id} first
|
||||
- {bead-id}: {title} (type: task) - Run /beads_plan {bead-id} first
|
||||
```
|
||||
|
||||
4. **Present selection**: Use `AskUserQuestion` with `multiSelect: true` to let the user choose which beads to work on
|
||||
- Include bead ID and title for each option
|
||||
- Only show beads that passed the plan check
|
||||
- Allow selection of multiple beads
|
||||
|
||||
Example:
|
||||
```
|
||||
AskUserQuestion with:
|
||||
- question: "Which beads do you want to work on in parallel?"
|
||||
- multiSelect: true
|
||||
- options from filtered bd ready output
|
||||
```
|
||||
|
||||
## Phase 2: Worktree Setup
|
||||
|
||||
Before launching implementation subagents, create worktrees for all selected beads:
|
||||
|
||||
1. **Get repository name**:
|
||||
```bash
|
||||
REPO_NAME=$(git remote get-url origin | sed 's|.*/||' | sed 's/\.git$//')
|
||||
```
|
||||
|
||||
2. **For each selected bead**, create its worktree:
|
||||
```bash
|
||||
BEAD_ID="[bead-id]"
|
||||
# Check if worktree already exists
|
||||
if [ -d "$HOME/wt/${REPO_NAME}/${BEAD_ID}" ]; then
|
||||
echo "Worktree already exists: ~/wt/${REPO_NAME}/${BEAD_ID}"
|
||||
# Ask user: remove and recreate, or skip this bead?
|
||||
else
|
||||
git worktree add -b "bead/${BEAD_ID}" "$HOME/wt/${REPO_NAME}/${BEAD_ID}"
|
||||
fi
|
||||
```
|
||||
|
||||
3. **Track created worktrees**:
|
||||
Maintain a list of (bead_id, worktree_path) pairs for use in subagent instructions.
|
||||
|
||||
4. **Report status**:
|
||||
```
|
||||
Created worktrees:
|
||||
- nixos-configs-abc → ~/wt/nixos-configs/nixos-configs-abc (branch: bead/nixos-configs-abc)
|
||||
- nixos-configs-xyz → ~/wt/nixos-configs/nixos-configs-xyz (branch: bead/nixos-configs-xyz)
|
||||
|
||||
Skipped (existing worktree):
|
||||
- nixos-configs-123 → Ask user for resolution
|
||||
```
|
||||
|
||||
**Note**: If a worktree or branch already exists, ask the user before proceeding:
|
||||
- Remove existing worktree and branch, then recreate
|
||||
- Skip this bead
|
||||
- Use existing worktree as-is (risky - branch may have diverged)
|
||||
|
||||
## Phase 3: Parallel Implementation
|
||||
|
||||
For each selected bead, launch a subagent using the Task tool. All subagents should be launched in parallel (single message with multiple Task tool calls).
|
||||
|
||||
### Subagent Instructions Template
|
||||
|
||||
Each implementation subagent should receive these instructions:
|
||||
|
||||
```
|
||||
Work on bead [BEAD_ID]: [BEAD_TITLE]
|
||||
|
||||
Worktree path: [WORKTREE_PATH]
|
||||
|
||||
## CRITICAL: Branch Verification (MUST DO FIRST)
|
||||
|
||||
1. **Navigate to worktree**:
|
||||
```bash
|
||||
cd [WORKTREE_PATH]
|
||||
```
|
||||
|
||||
2. **Verify branch** (MANDATORY before ANY modifications):
|
||||
```bash
|
||||
CURRENT_BRANCH=$(git branch --show-current)
|
||||
echo "Current branch: $CURRENT_BRANCH"
|
||||
pwd
|
||||
```
|
||||
|
||||
**ABORT CONDITIONS** - If ANY of these are true, STOP IMMEDIATELY:
|
||||
- Branch is `main` or `master`
|
||||
- Branch does not match `bead/[BEAD_ID]`
|
||||
|
||||
If you detect any abort condition:
|
||||
```
|
||||
ABORTING: Branch verification failed.
|
||||
Expected branch: bead/[BEAD_ID]
|
||||
Actual branch: [CURRENT_BRANCH]
|
||||
Working directory: [pwd output]
|
||||
|
||||
DO NOT PROCEED. Report this error to the orchestrator.
|
||||
```
|
||||
|
||||
## After Verification Passes
|
||||
|
||||
3. **Review the bead requirements**:
|
||||
- Run `bd show [BEAD_ID]` to understand the acceptance criteria
|
||||
- Note any external issue references (GitHub issues, Linear tickets, etc.)
|
||||
|
||||
4. **Extract validation criteria**:
|
||||
- Check for a plan: `thoughts/beads-[BEAD_ID]/plan.md`
|
||||
- If plan exists:
|
||||
- Read the plan and find the "Automated Verification" section
|
||||
- Extract each verification command (lines starting with `- [ ]` followed by a command)
|
||||
- Example: `- [ ] Tests pass: \`make test\`` → extract `make test`
|
||||
- Note any "Per CONTRIBUTING.md:" requirements for additional validation
|
||||
- Also read the "Manual Verification" section from the plan if present
|
||||
- Save manual verification items for inclusion in the PR description (they won't be executed)
|
||||
- If no plan exists, use best-effort validation:
|
||||
- Check if `Makefile` exists → try `make test` and `make lint`
|
||||
- Check if `flake.nix` exists → try `nix flake check`
|
||||
- Check if `package.json` exists → try `npm test`
|
||||
- **Check for CONTRIBUTING.md** → read and extract testing/linting requirements
|
||||
- Track which requirements can be automated vs need manual review
|
||||
- Automated: commands that can be run (e.g., "run `make test`")
|
||||
- Manual: qualitative checks (e.g., "ensure documentation is updated")
|
||||
- If none found, note "No validation criteria found"
|
||||
|
||||
5. **Implement the changes**:
|
||||
- Work in the worktree directory
|
||||
- Complete all acceptance criteria listed in the bead
|
||||
|
||||
After implementation, run validation:
|
||||
- Execute each validation command from step 4
|
||||
- Track results in this format:
|
||||
```
|
||||
VALIDATION_RESULTS:
|
||||
- make test: PASS
|
||||
- make lint: FAIL (exit code 1: src/foo.ts:23 - missing semicolon)
|
||||
- nix flake check: SKIP (not applicable - no flake.nix)
|
||||
- cargo test: ERROR (command not found)
|
||||
```
|
||||
|
||||
**Status definitions:**
|
||||
- **PASS**: Check executed successfully with no issues
|
||||
- **FAIL**: Check executed but found issues that need attention
|
||||
- **SKIP**: Check not applicable to this project (e.g., no Makefile for `make test`)
|
||||
- **ERROR**: Check could not execute (missing tool, permission error, command not found)
|
||||
|
||||
- If any validation fails:
|
||||
- Continue with PR creation (don't block)
|
||||
- Document failures in bead notes: `bd update [BEAD_ID] --notes="Validation failures: [list]"`
|
||||
|
||||
6. **Commit and push**:
|
||||
- Stage all changes: `git add -A`
|
||||
- Create a descriptive commit message
|
||||
- Push the branch: `git push -u origin bead/[BEAD_ID]`
|
||||
|
||||
7. **Create a PR**:
|
||||
- Detect hosting provider from origin URL: `git remote get-url origin`
|
||||
- If URL contains `github.com`, use `gh`; otherwise use `tea` (Gitea/Forgejo)
|
||||
- PR title: "[BEAD_ID] [BEAD_TITLE]"
|
||||
- PR body must include:
|
||||
- Reference to bead ID: "Implements bead: [BEAD_ID]"
|
||||
- Any external issue references from the bead (e.g., "Closes #123")
|
||||
- Summary of changes
|
||||
- For GitHub (`gh`):
|
||||
```bash
|
||||
gh pr create --title "[BEAD_ID] [BEAD_TITLE]" --body "$(cat <<'EOF'
|
||||
## Summary
|
||||
[Brief description of changes]
|
||||
|
||||
## Bead Reference
|
||||
Implements bead: [BEAD_ID]
|
||||
|
||||
## External Issues
|
||||
[Any linked issues from the bead]
|
||||
|
||||
## Changes
|
||||
- [List of changes made]
|
||||
|
||||
## Validation Steps Completed
|
||||
|
||||
### Automated Checks
|
||||
| Check | Status | Details |
|
||||
|-------|--------|---------|
|
||||
| make test | PASS | |
|
||||
| make lint | FAIL | src/foo.ts:23 - missing semicolon |
|
||||
| nix flake check | SKIP | not applicable - no flake.nix |
|
||||
| cargo test | ERROR | command not found |
|
||||
|
||||
### Manual Verification Required
|
||||
[If plan has Manual Verification items, list them as unchecked boxes:]
|
||||
- [ ] Verify UI changes match design mockups
|
||||
- [ ] Test on mobile viewport sizes
|
||||
[If no manual verification items: "None specified in plan."]
|
||||
|
||||
### CONTRIBUTING.md Compliance
|
||||
[If CONTRIBUTING.md requirements were extracted:]
|
||||
- [x] Tests pass (verified via `make test`)
|
||||
- [ ] Documentation updated (needs manual review)
|
||||
[If no CONTRIBUTING.md: "No contribution guidelines found."]
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
- For Gitea (`tea`):
|
||||
```bash
|
||||
tea pr create --head bead/[BEAD_ID] --base main \
|
||||
--title "[BEAD_ID] [BEAD_TITLE]" \
|
||||
--description "## Summary
|
||||
[Brief description of changes]
|
||||
|
||||
## Bead Reference
|
||||
Implements bead: [BEAD_ID]
|
||||
|
||||
## External Issues
|
||||
[Any linked issues from the bead]
|
||||
|
||||
## Changes
|
||||
- [List of changes made]
|
||||
|
||||
## Validation Steps Completed
|
||||
|
||||
### Automated Checks
|
||||
| Check | Status | Details |
|
||||
|-------|--------|---------|
|
||||
| make test | PASS | |
|
||||
| make lint | FAIL | src/foo.ts:23 - missing semicolon |
|
||||
| nix flake check | SKIP | not applicable - no flake.nix |
|
||||
| cargo test | ERROR | command not found |
|
||||
|
||||
### Manual Verification Required
|
||||
[If plan has Manual Verification items, list them as unchecked boxes:]
|
||||
- [ ] Verify UI changes match design mockups
|
||||
- [ ] Test on mobile viewport sizes
|
||||
[If no manual verification items: None specified in plan.]
|
||||
|
||||
### CONTRIBUTING.md Compliance
|
||||
[If CONTRIBUTING.md requirements were extracted:]
|
||||
- [x] Tests pass (verified via make test)
|
||||
- [ ] Documentation updated (needs manual review)
|
||||
[If no CONTRIBUTING.md: No contribution guidelines found.]"
|
||||
```
|
||||
|
||||
8. **Update bead status**:
|
||||
- Mark the bead as "in_review": `bd update [BEAD_ID] --status=in_review`
|
||||
- Add the PR URL to the bead notes: `bd update [BEAD_ID] --notes="$(bd show [BEAD_ID] --json | jq -r '.notes')
|
||||
|
||||
PR: [PR_URL]"`
|
||||
|
||||
9. **Report results**:
|
||||
- Return:
|
||||
- PR URL
|
||||
- Bead ID
|
||||
- Implementation status (success/failure/blocked)
|
||||
- Validation summary: `X passed, Y failed, Z skipped, W errors`
|
||||
- List of any validation failures or errors with details
|
||||
- If blocked or unable to complete, explain what's blocking progress
|
||||
- If validation failed, include the specific failures so the main agent can summarize them for the user
|
||||
```
|
||||
|
||||
### Launching Subagents
|
||||
|
||||
For each bead, substitute into the template:
|
||||
- `[BEAD_ID]` - the bead ID
|
||||
- `[BEAD_TITLE]` - the bead title
|
||||
- `[WORKTREE_PATH]` - the worktree path created in Phase 2
|
||||
|
||||
Use `subagent_type: "general-purpose"` for implementation subagents. Launch all selected beads' subagents in a single message for parallel execution:
|
||||
|
||||
```
|
||||
<Task calls for each selected bead - all in one message>
|
||||
```
|
||||
|
||||
**Important**: The worktree paths were created in Phase 2. Use the exact paths that were created, e.g.:
|
||||
- `~/wt/nixos-configs/nixos-configs-abc`
|
||||
- `~/wt/nixos-configs/nixos-configs-xyz`
|
||||
|
||||
Collect results from all subagents before proceeding.
|
||||
|
||||
## Phase 4: Parallel Review
|
||||
|
||||
After all implementation subagents complete, launch review subagents for each PR.
|
||||
|
||||
### Review Subagent Instructions Template
|
||||
|
||||
```
|
||||
Review PR for bead [BEAD_ID]
|
||||
|
||||
1. **Detect hosting provider**: Run `git remote get-url origin` - if it contains `github.com` use `gh`, otherwise use `tea`
|
||||
|
||||
2. **Read the PR**:
|
||||
- For GitHub: `gh pr view [PR_NUMBER] --json title,body,additions,deletions,files`
|
||||
- For Gitea: `tea pr view [PR_NUMBER]`
|
||||
- View the diff: `git diff main...bead/[BEAD_ID]`
|
||||
|
||||
3. **Review against acceptance criteria**:
|
||||
- Run `bd show [BEAD_ID]` to get the acceptance criteria
|
||||
- Verify each criterion is addressed
|
||||
|
||||
4. **Leave review comments**:
|
||||
- For GitHub: `gh pr review [PR_NUMBER] --comment --body "[COMMENTS]"`
|
||||
- For Gitea: `tea pr review [PR_NUMBER] --comment "[COMMENTS]"`
|
||||
- Include:
|
||||
- Acceptance criteria checklist (which are met, which might be missing)
|
||||
- Code quality observations
|
||||
- Suggestions for improvement
|
||||
|
||||
5. **Return summary**:
|
||||
- Overall assessment (ready to merge / needs changes)
|
||||
- Key findings
|
||||
```
|
||||
|
||||
Launch all review subagents in parallel.
|
||||
|
||||
## Phase 5: Cleanup and Summary
|
||||
|
||||
After reviews complete:
|
||||
|
||||
1. **Clean up worktrees**:
|
||||
```bash
|
||||
git worktree remove ~/wt/[REPO_NAME]/[BEAD_ID] --force
|
||||
```
|
||||
Do this for each bead's worktree.
|
||||
|
||||
2. **Provide final summary**:
|
||||
Present a table or list with:
|
||||
- Bead ID
|
||||
- PR URL
|
||||
- Status (success / failed / blocked)
|
||||
- Validation summary (X/Y passed)
|
||||
- Review summary
|
||||
- Any failures or blockers encountered
|
||||
|
||||
If any validation failures occurred, list them in a "Validation Failures" section so the user can address them.
|
||||
|
||||
Example output:
|
||||
```
|
||||
## Parallel Beads Summary
|
||||
|
||||
| Bead | PR | Bead Status | Validation | Review |
|
||||
|------|-----|-------------|------------|--------|
|
||||
| beads-abc | #123 | in_review | 3/3 passed | Approved |
|
||||
| beads-xyz | #124 | in_review | 2/3 passed | Needs changes |
|
||||
| beads-123 | - | open (failed) | - | Blocked by missing dependency |
|
||||
|
||||
### Validation Failures
|
||||
- beads-xyz: `make lint` failed - src/foo.ts:23 missing semicolon
|
||||
|
||||
### Failures/Blockers
|
||||
- beads-123: Could not complete because [reason]
|
||||
|
||||
### Next Steps
|
||||
- Fix validation failures before merging
|
||||
- Review PRs that need changes
|
||||
- Address blockers for failed beads
|
||||
- Run `/reconcile_beads` after PRs are merged to close beads
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **Worktree creation failures** (Phase 2):
|
||||
- If `git worktree add` fails (branch exists, path exists), prompt user:
|
||||
- Remove existing and retry
|
||||
- Skip this bead
|
||||
- Use existing (with warning about potential divergence)
|
||||
- Do NOT proceed to subagent launch until worktree is confirmed
|
||||
|
||||
- **Branch verification failures** (subagent reports):
|
||||
- If subagent reports it's on `main` or `master`, do NOT retry
|
||||
- Mark bead as failed with reason "Branch verification failed"
|
||||
- Continue with other beads but flag this as a critical issue
|
||||
- Investigation required: the worktree may have been corrupted or not created properly
|
||||
|
||||
- **Subagent failures**: If a subagent fails or times out, note it in the summary but continue with other beads
|
||||
- **PR creation failures**: Report the error but continue with reviews of successful PRs
|
||||
|
||||
## Resource Limits
|
||||
|
||||
- Consider limiting concurrent subagents to 3-5 to avoid overwhelming system resources
|
||||
- If user selects more beads than the limit, process them in batches
|
||||
|
||||
## Notes
|
||||
|
||||
- This workflow integrates with the beads system (`bd` commands)
|
||||
- Worktrees are created in `~/wt/[REPO_NAME]/` by convention
|
||||
- Each bead gets its own isolated branch and worktree
|
||||
- PRs automatically reference the bead ID for traceability
|
||||
129
home/roles/development/commands/reconcile_beads.md
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
description: Reconcile beads with merged PRs and close completed beads
|
||||
---
|
||||
|
||||
# Reconcile Beads Workflow
|
||||
|
||||
This skill reconciles beads that are in `in_review` status with their corresponding PRs. If a PR has been merged, the bead is closed and any linked Gitea issue is also closed.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Custom status `in_review` must be configured: `bd config set status.custom "in_review"`
|
||||
- Beads in `in_review` status should have a PR URL in their notes
|
||||
- `tea` CLI must be configured for closing Gitea issues
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Find beads in review
|
||||
|
||||
```bash
|
||||
bd list --status=in_review
|
||||
```
|
||||
|
||||
### Step 2: For each bead, check PR status
|
||||
|
||||
1. **Get the PR URL from bead notes**:
|
||||
```bash
|
||||
bd show [BEAD_ID] --json | jq -r '.[0].notes'
|
||||
```
|
||||
Note: `bd show --json` returns an array, so use `.[0]` to access the first element.
|
||||
Extract the PR URL (look for lines starting with "PR:" or containing pull request URLs).
|
||||
Extract the PR number: `echo "$NOTES" | grep -oP '/pulls/\K\d+'`
|
||||
|
||||
2. **Detect hosting provider**:
|
||||
- Run `git remote get-url origin`
|
||||
- If URL contains `github.com`, use `gh`; otherwise use `tea` (Gitea/Forgejo)
|
||||
|
||||
3. **Check PR status**:
|
||||
- For GitHub:
|
||||
```bash
|
||||
gh pr view [PR_NUMBER] --json state,merged
|
||||
```
|
||||
- For Gitea:
|
||||
```bash
|
||||
tea pr list --state=closed
|
||||
```
|
||||
Look for the PR number in the INDEX column with STATE "merged".
|
||||
Note: `tea pr view [PR_NUMBER]` lists all PRs, not a specific one. Use `tea pr list --state=closed` and look for your PR number in the results.
|
||||
|
||||
### Step 3: Close merged beads
|
||||
|
||||
If the PR is merged:
|
||||
```bash
|
||||
bd close [BEAD_ID] --reason="PR merged: [PR_URL]"
|
||||
```
|
||||
|
||||
### Step 3.1: Close corresponding Gitea issue (if any)
|
||||
|
||||
After closing a bead, check if it has a linked Gitea issue:
|
||||
|
||||
1. **Check for Gitea issue URL in bead notes**:
|
||||
Look for the pattern `Gitea issue: <URL>` in the notes. Extract the URL.
|
||||
|
||||
2. **Extract issue number from URL**:
|
||||
```bash
|
||||
# Example: https://git.johnogle.info/johno/nixos-configs/issues/16 -> 16
|
||||
echo "$GITEA_URL" | grep -oP '/issues/\K\d+'
|
||||
```
|
||||
|
||||
3. **Close the Gitea issue**:
|
||||
```bash
|
||||
tea issues close [ISSUE_NUMBER]
|
||||
```
|
||||
|
||||
4. **Handle errors gracefully**:
|
||||
- If issue is already closed: Log warning, continue
|
||||
- If issue not found: Log warning, continue
|
||||
- If `tea` fails: Log error, continue with other beads
|
||||
|
||||
Example warning output:
|
||||
```
|
||||
Warning: Could not close Gitea issue #16: issue already closed
|
||||
```
|
||||
|
||||
### Step 4: Report summary
|
||||
|
||||
Present results:
|
||||
|
||||
```
|
||||
## Beads Reconciliation Summary
|
||||
|
||||
### Closed (PR Merged)
|
||||
| Bead | PR | Gitea Issue | Title |
|
||||
|------|-----|-------------|-------|
|
||||
| beads-abc | #123 | #16 closed | Feature X |
|
||||
| beads-xyz | #456 | (none) | Bug fix Y |
|
||||
|
||||
### Gitea Issues Closed
|
||||
| Issue | Bead | Status |
|
||||
|-------|------|--------|
|
||||
| #16 | beads-abc | Closed successfully |
|
||||
| #17 | beads-def | Already closed (skipped) |
|
||||
| #99 | beads-ghi | Error: issue not found |
|
||||
|
||||
### Still in Review
|
||||
| Bead | PR | Status | Title |
|
||||
|------|-----|--------|-------|
|
||||
| beads-def | #789 | Open | Feature Z |
|
||||
|
||||
### Issues Found
|
||||
- beads-ghi: No PR URL found in notes
|
||||
- beads-jkl: PR #999 not found (may have been deleted)
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **Missing PR URL**: Skip the bead and report it
|
||||
- **PR not found**: Report the error but continue with other beads
|
||||
- **API errors**: Report and continue
|
||||
- **Gitea issue already closed**: Log warning, continue (not an error)
|
||||
- **Gitea issue not found**: Log warning, continue (issue may have been deleted)
|
||||
- **No Gitea issue linked**: Normal case, no action needed
|
||||
- **tea command fails**: Log error with output, continue with other beads
|
||||
|
||||
## Notes
|
||||
|
||||
- This skill complements `/parallel_beads` which sets beads to `in_review` status
|
||||
- Run this skill periodically or after merging PRs to keep beads in sync
|
||||
- Beads with closed (but not merged) PRs are not automatically closed - they may need rework
|
||||
- Gitea issues are only closed for beads that have a `Gitea issue: <URL>` in their notes
|
||||
287
home/roles/development/default.nix
Normal file
@@ -0,0 +1,287 @@
|
||||
{ config, lib, pkgs, globalInputs, system, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.development;
|
||||
|
||||
# Build beads from flake input with corrected vendorHash
|
||||
# The upstream default.nix has stale vendorHash for commits with server mode
|
||||
beadsRev = builtins.substring 0 8 (globalInputs.beads.rev or "unknown");
|
||||
beadsPackage = pkgs.buildGoModule {
|
||||
pname = "beads";
|
||||
version = "0.49.1-${beadsRev}";
|
||||
src = globalInputs.beads;
|
||||
subPackages = [ "cmd/bd" ];
|
||||
doCheck = false;
|
||||
# Regenerated vendorHash for commit 93965b4a (has dolt server mode, Go 1.24)
|
||||
vendorHash = "sha256-gwxGv8y4+1+k0741CnOYcyJPTJ5vTrynqPoO8YS9fbQ=";
|
||||
nativeBuildInputs = [ pkgs.git ];
|
||||
meta = with lib; {
|
||||
description = "beads (bd) - An issue tracker designed for AI-supervised coding workflows";
|
||||
homepage = "https://github.com/steveyegge/beads";
|
||||
license = licenses.mit;
|
||||
mainProgram = "bd";
|
||||
};
|
||||
};
|
||||
|
||||
# Gastown - multi-agent workspace manager (no upstream flake.nix yet)
|
||||
# Source is tracked via flake input for renovate updates
|
||||
gastownRev = builtins.substring 0 8 (globalInputs.gastown.rev or "unknown");
|
||||
gastownPackage = pkgs.buildGoModule {
|
||||
pname = "gastown";
|
||||
version = "unstable-${gastownRev}";
|
||||
src = globalInputs.gastown;
|
||||
vendorHash = "sha256-ripY9vrYgVW8bngAyMLh0LkU/Xx1UUaLgmAA7/EmWQU=";
|
||||
subPackages = [ "cmd/gt" ];
|
||||
doCheck = false;
|
||||
|
||||
# Must match ldflags from gastown Makefile - BuiltProperly=1 is required
|
||||
# or gt will error with "This binary was built with 'go build' directly"
|
||||
ldflags = [
|
||||
"-X github.com/steveyegge/gastown/internal/cmd.Version=${gastownRev}"
|
||||
"-X github.com/steveyegge/gastown/internal/cmd.Commit=${gastownRev}"
|
||||
"-X github.com/steveyegge/gastown/internal/cmd.BuildTime=nix-build"
|
||||
"-X github.com/steveyegge/gastown/internal/cmd.BuiltProperly=1"
|
||||
];
|
||||
|
||||
# Bug fixes not yet merged upstream
|
||||
# Each patch is stored in a separate file for clarity and maintainability
|
||||
patches = [
|
||||
# Fix validateRecipient bug: normalize addresses before comparison
|
||||
./gastown-fix-validate-recipient.patch
|
||||
# Fix agentBeadToAddress to use title field for hq- prefixed beads
|
||||
./gastown-fix-agent-bead-address-title.patch
|
||||
# Fix crew/polecat home paths: remove incorrect /rig suffix
|
||||
./gastown-fix-role-home-paths.patch
|
||||
# Fix town root detection: don't map to Mayor (causes spurious mismatch warnings)
|
||||
./gastown-fix-town-root-detection.patch
|
||||
# Statusline optimization: skip expensive beads queries for detached sessions
|
||||
# Reduces Dolt CPU from ~70% to ~20% by caching and early-exit
|
||||
./gastown-statusline-optimization.patch
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Gas Town - multi-agent workspace manager by Steve Yegge";
|
||||
homepage = "https://github.com/steveyegge/gastown";
|
||||
license = licenses.mit;
|
||||
mainProgram = "gt";
|
||||
};
|
||||
};
|
||||
|
||||
# Perles - TUI for beads issue tracking (no upstream flake.nix yet)
|
||||
# Source is tracked via flake input for renovate updates
|
||||
perlesRev = builtins.substring 0 8 (globalInputs.perles.rev or "unknown");
|
||||
perlesPackage = pkgs.buildGoModule {
|
||||
pname = "perles";
|
||||
version = "unstable-${perlesRev}";
|
||||
src = globalInputs.perles;
|
||||
vendorHash = "sha256-JHERJDzbiqgjWXwRhXVjgDEiDQ3AUXRIONotfPF21B0=";
|
||||
doCheck = false;
|
||||
|
||||
ldflags = [
|
||||
"-X main.version=${perlesRev}"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Perles - Terminal UI for beads issue tracking";
|
||||
homepage = "https://github.com/zjrosen/perles";
|
||||
license = licenses.mit;
|
||||
mainProgram = "perles";
|
||||
};
|
||||
};
|
||||
|
||||
# Fetch the claude-plugins repository (for humanlayer commands/agents)
|
||||
# Update the rev to get newer versions of the commands
|
||||
claudePluginsRepo = builtins.fetchGit {
|
||||
url = "https://github.com/jeffh/claude-plugins.git";
|
||||
# To update: change this to the latest commit hash
|
||||
# You can find the latest commit at: https://github.com/jeffh/claude-plugins/commits/main
|
||||
rev = "5e3e4d937162185b6d78c62022cbfd1c8ad42c4c";
|
||||
ref = "main";
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
options.home.roles.development = {
|
||||
enable = mkEnableOption "Enable development tools and utilities";
|
||||
|
||||
allowArbitraryClaudeCodeModelSelection = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to preserve model specifications in Claude Code humanlayer commands and agents.
|
||||
|
||||
When false (default), the model: line is stripped from frontmatter, allowing Claude Code
|
||||
to use its default model selection.
|
||||
|
||||
When true, the model: specifications from the source files are preserved, allowing
|
||||
commands to specify opus/sonnet/haiku explicitly.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
beadsPackage
|
||||
gastownPackage
|
||||
perlesPackage
|
||||
pkgs.unstable.claude-code
|
||||
pkgs.unstable.claude-code-router
|
||||
pkgs.unstable.codex
|
||||
pkgs.dolt
|
||||
pkgs.sqlite
|
||||
|
||||
# Custom packages
|
||||
pkgs.custom.tea-rbw
|
||||
];
|
||||
|
||||
# Install Claude Code humanlayer command and agent plugins
|
||||
home.activation.claudeCodeCommands = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
# Clean up old plugin-installed commands and agents to avoid duplicates
|
||||
rm -f ~/.claude/commands/humanlayer:* 2>/dev/null || true
|
||||
rm -f ~/.claude/agents/humanlayer:* 2>/dev/null || true
|
||||
|
||||
# Create directories if they don't exist
|
||||
mkdir -p ~/.claude/commands
|
||||
mkdir -p ~/.claude/agents
|
||||
|
||||
# Copy all humanlayer command files and remove model specifications
|
||||
for file in ${claudePluginsRepo}/humanlayer/commands/*.md; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename "$file" .md)
|
||||
dest="$HOME/.claude/commands/humanlayer:''${filename}.md"
|
||||
rm -f "$dest" 2>/dev/null || true
|
||||
|
||||
# Copy file and conditionally remove the "model:" line from frontmatter
|
||||
${if cfg.allowArbitraryClaudeCodeModelSelection
|
||||
then "cp \"$file\" \"$dest\""
|
||||
else "${pkgs.gnused}/bin/sed '/^model:/d' \"$file\" > \"$dest\""
|
||||
}
|
||||
chmod u+w "$dest" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy all humanlayer agent files and remove model specifications
|
||||
for file in ${claudePluginsRepo}/humanlayer/agents/*.md; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename "$file" .md)
|
||||
dest="$HOME/.claude/agents/humanlayer:''${filename}.md"
|
||||
rm -f "$dest" 2>/dev/null || true
|
||||
|
||||
# Copy file and conditionally remove the "model:" line from frontmatter
|
||||
${if cfg.allowArbitraryClaudeCodeModelSelection
|
||||
then "cp \"$file\" \"$dest\""
|
||||
else "${pkgs.gnused}/bin/sed '/^model:/d' \"$file\" > \"$dest\""
|
||||
}
|
||||
chmod u+w "$dest" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy local commands from this repo (with retry for race conditions with running Claude)
|
||||
for file in ${./commands}/*.md; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename "$file" .md)
|
||||
dest="$HOME/.claude/commands/''${filename}.md"
|
||||
# Remove existing file first, then copy with retry on failure
|
||||
rm -f "$dest" 2>/dev/null || true
|
||||
if ! cp "$file" "$dest" 2>/dev/null; then
|
||||
sleep 0.5
|
||||
cp "$file" "$dest" || echo "Warning: Failed to copy $filename.md to commands"
|
||||
fi
|
||||
chmod u+w "$dest" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy local skills (reference materials) to skills subdirectory
|
||||
mkdir -p ~/.claude/commands/skills
|
||||
for file in ${./skills}/*.md; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename "$file" .md)
|
||||
dest="$HOME/.claude/commands/skills/''${filename}.md"
|
||||
rm -f "$dest" 2>/dev/null || true
|
||||
if ! cp "$file" "$dest" 2>/dev/null; then
|
||||
sleep 0.5
|
||||
cp "$file" "$dest" || echo "Warning: Failed to copy $filename.md to skills"
|
||||
fi
|
||||
chmod u+w "$dest" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy micro-skills (compact reusable knowledge referenced by formulas)
|
||||
for file in ${./skills/micro}/*.md; do
|
||||
if [ -f "$file" ]; then
|
||||
dest="$HOME/.claude/commands/skills/$(basename "$file")"
|
||||
rm -f "$dest" 2>/dev/null || true
|
||||
cp "$file" "$dest"
|
||||
chmod u+w "$dest" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Install beads formulas to user-level formula directory
|
||||
mkdir -p ~/.beads/formulas
|
||||
for file in ${./formulas}/*.formula.toml; do
|
||||
if [ -f "$file" ]; then
|
||||
dest="$HOME/.beads/formulas/$(basename "$file")"
|
||||
rm -f "$dest" 2>/dev/null || true
|
||||
cp "$file" "$dest"
|
||||
chmod u+w "$dest" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
$DRY_RUN_CMD echo "Claude Code plugins installed: humanlayer commands/agents + local commands + local skills + formulas"
|
||||
'';
|
||||
|
||||
# Set up beads Claude Code integration (hooks for SessionStart/PreCompact)
|
||||
# This uses the CLI + hooks approach which is recommended over MCP for Claude Code
|
||||
home.activation.claudeCodeBeadsSetup = lib.hm.dag.entryAfter ["writeBoundary" "claudeCodeCommands"] ''
|
||||
# Run bd setup claude to install hooks into ~/.claude/settings.json
|
||||
# This is idempotent - safe to run multiple times
|
||||
${beadsPackage}/bin/bd setup claude 2>/dev/null || true
|
||||
|
||||
$DRY_RUN_CMD echo "Claude Code beads integration configured (hooks installed)"
|
||||
'';
|
||||
|
||||
# Beads timer gate checker (Linux only - uses systemd)
|
||||
# Runs every 5 minutes to auto-resolve expired timer gates across all beads projects
|
||||
# This enables self-scheduling molecules (watchers, patrols, etc.)
|
||||
systemd.user.services.beads-gate-check = lib.mkIf pkgs.stdenv.isLinux {
|
||||
Unit = {
|
||||
Description = "Check and resolve expired beads timer gates";
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
# Check gates in all workspaces that have running daemons
|
||||
ExecStart = pkgs.writeShellScript "beads-gate-check-all" ''
|
||||
# Get list of workspaces from daemon registry
|
||||
workspaces=$(${beadsPackage}/bin/bd daemon list --json 2>/dev/null | ${pkgs.jq}/bin/jq -r '.[].workspace // empty' 2>/dev/null)
|
||||
|
||||
if [ -z "$workspaces" ]; then
|
||||
exit 0 # No beads workspaces, nothing to do
|
||||
fi
|
||||
|
||||
for ws in $workspaces; do
|
||||
if [ -d "$ws" ]; then
|
||||
cd "$ws" && ${beadsPackage}/bin/bd gate check --type=timer --quiet 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.timers.beads-gate-check = lib.mkIf pkgs.stdenv.isLinux {
|
||||
Unit = {
|
||||
Description = "Periodic beads timer gate check";
|
||||
};
|
||||
Timer = {
|
||||
OnBootSec = "5min";
|
||||
OnUnitActiveSec = "5min";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
# Note: modules must be imported at top-level home config
|
||||
};
|
||||
}
|
||||
115
home/roles/development/formulas/quick-fix.formula.toml
Normal file
@@ -0,0 +1,115 @@
|
||||
# Quick Fix Formula
|
||||
#
|
||||
# Streamlined workflow for well-understood bugs and small fixes.
|
||||
# Skips the deep research and planning phases of RPI - get in, fix, get out.
|
||||
#
|
||||
# Use when:
|
||||
# - Bug is well-understood (you know what's broken)
|
||||
# - Fix is straightforward (no architectural decisions)
|
||||
# - Change is small (< 100 lines)
|
||||
#
|
||||
# Use RPI instead when:
|
||||
# - Root cause is unclear
|
||||
# - Multiple approaches possible
|
||||
# - Significant design decisions needed
|
||||
|
||||
formula = "quick-fix"
|
||||
description = """
|
||||
Streamlined workflow for bugs and small fixes.
|
||||
|
||||
A faster alternative to RPI for well-understood issues:
|
||||
1. Quick investigation to confirm understanding
|
||||
2. Implement the fix
|
||||
3. Verify with tests
|
||||
4. Commit and close
|
||||
|
||||
No human gates - designed for quick turnaround on obvious fixes.
|
||||
"""
|
||||
version = 1
|
||||
type = "workflow"
|
||||
|
||||
# === Variables ===
|
||||
|
||||
[vars.title]
|
||||
required = true
|
||||
description = "Brief description of the bug/fix"
|
||||
|
||||
[vars.bead_id]
|
||||
description = "Existing bead ID (creates new if not provided)"
|
||||
|
||||
[vars.test_cmd]
|
||||
default = "make test"
|
||||
description = "Command to verify the fix"
|
||||
|
||||
# === Steps ===
|
||||
|
||||
[[steps]]
|
||||
id = "investigate"
|
||||
title = "Investigate: {{title}}"
|
||||
description = """
|
||||
Quick investigation to confirm understanding of the bug.
|
||||
|
||||
Goals:
|
||||
- Locate the problematic code
|
||||
- Confirm root cause matches expectations
|
||||
- Identify files that need changes
|
||||
|
||||
This is NOT deep research - spend 5-10 minutes max.
|
||||
If the bug is more complex than expected, pivot to RPI workflow.
|
||||
|
||||
Output: Mental model of what to fix (no artifact needed).
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "fix"
|
||||
title = "Fix: {{title}}"
|
||||
needs = ["investigate"]
|
||||
description = """
|
||||
Implement the fix.
|
||||
|
||||
Guidelines:
|
||||
- Make minimal changes to fix the issue
|
||||
- Follow existing code patterns
|
||||
- Add/update tests if appropriate
|
||||
- Keep changes focused (no drive-by refactors)
|
||||
|
||||
If the fix grows beyond expectations, pause and consider:
|
||||
- Should this be an RPI workflow instead?
|
||||
- Should we split into multiple changes?
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "verify"
|
||||
title = "Verify fix"
|
||||
needs = ["fix"]
|
||||
description = """
|
||||
Verify the fix works correctly.
|
||||
|
||||
Run: {{test_cmd}}
|
||||
|
||||
Also check:
|
||||
- Bug is actually fixed (manual verification)
|
||||
- No obvious regressions introduced
|
||||
- Code compiles/builds cleanly
|
||||
|
||||
If tests fail, iterate on the fix step.
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "commit"
|
||||
title = "Commit and close"
|
||||
needs = ["verify"]
|
||||
description = """
|
||||
Commit the fix and close the bead.
|
||||
|
||||
Actions:
|
||||
1. Stage changes: git add -A
|
||||
2. Commit with descriptive message: git commit -m "fix: {{title}}"
|
||||
3. Push to remote: git push
|
||||
4. Close the bead: bd close {{bead_id}}
|
||||
|
||||
Commit message should explain:
|
||||
- What was broken
|
||||
- How it was fixed
|
||||
- Any relevant context
|
||||
"""
|
||||
124
home/roles/development/formulas/rpi.formula.toml
Normal file
@@ -0,0 +1,124 @@
|
||||
# RPI Formula - Research -> Plan -> Implement
|
||||
#
|
||||
# Universal workflow for feature development with human gates.
|
||||
|
||||
formula = "rpi"
|
||||
description = """
|
||||
Research -> Plan -> Implement workflow.
|
||||
|
||||
Usage:
|
||||
bd pour rpi --var title="Add user preferences"
|
||||
bd pour rpi --var title="Auth" --var bead_id="project-abc" --var test_cmd="nix flake check"
|
||||
"""
|
||||
version = 1
|
||||
type = "workflow"
|
||||
|
||||
# ─── Variables ───
|
||||
|
||||
[vars.title]
|
||||
required = true
|
||||
description = "What are we building?"
|
||||
|
||||
[vars.bead_id]
|
||||
description = "Existing bead ID (creates new if not provided)"
|
||||
|
||||
[vars.test_cmd]
|
||||
default = "make test"
|
||||
description = "Command to run tests"
|
||||
|
||||
[vars.lint_cmd]
|
||||
default = "make lint"
|
||||
description = "Command to run linting"
|
||||
|
||||
# ─── Research Phase ───
|
||||
|
||||
[[steps]]
|
||||
id = "research"
|
||||
title = "Research: {{title}}"
|
||||
skill = "research-agents"
|
||||
description = """
|
||||
Conduct comprehensive codebase research.
|
||||
|
||||
Goals:
|
||||
- Understand current implementation
|
||||
- Identify patterns to follow
|
||||
- Find relevant files and dependencies
|
||||
- Document key discoveries
|
||||
|
||||
Output: thoughts/beads-{{bead_id}}/research.md
|
||||
"""
|
||||
|
||||
# ─── Planning Phase ───
|
||||
|
||||
[[steps]]
|
||||
id = "plan"
|
||||
title = "Plan: {{title}}"
|
||||
needs = ["research"]
|
||||
type = "human"
|
||||
skill = "planning"
|
||||
description = """
|
||||
Create detailed implementation plan based on research.
|
||||
|
||||
Goals:
|
||||
- Present understanding and clarify requirements
|
||||
- Propose design options with tradeoffs
|
||||
- Define phases with success criteria
|
||||
- Identify what we're NOT doing
|
||||
|
||||
Output: thoughts/beads-{{bead_id}}/plan.md
|
||||
"""
|
||||
|
||||
[steps.gate]
|
||||
type = "human"
|
||||
reason = "Plan approval before implementation"
|
||||
|
||||
# ─── Implementation Phase ───
|
||||
|
||||
[[steps]]
|
||||
id = "implement"
|
||||
title = "Implement: {{title}}"
|
||||
needs = ["plan"]
|
||||
description = """
|
||||
Execute the approved plan phase by phase.
|
||||
|
||||
For each phase:
|
||||
1. Make the changes
|
||||
2. Run verification: {{test_cmd}}, {{lint_cmd}}
|
||||
3. Update plan checkboxes for resumability
|
||||
|
||||
Stop and ask if encountering unexpected issues.
|
||||
"""
|
||||
|
||||
# ─── Verification Phase ───
|
||||
|
||||
[[steps]]
|
||||
id = "verify"
|
||||
title = "Manual verification"
|
||||
needs = ["implement"]
|
||||
type = "human"
|
||||
description = """
|
||||
Human confirms implementation works correctly.
|
||||
|
||||
Check: feature works, edge cases handled, no regressions.
|
||||
Tests: {{test_cmd}} | Lint: {{lint_cmd}}
|
||||
"""
|
||||
|
||||
[steps.gate]
|
||||
type = "human"
|
||||
reason = "Confirm implementation is correct"
|
||||
|
||||
# ─── Completion ───
|
||||
|
||||
[[steps]]
|
||||
id = "complete"
|
||||
title = "Close bead"
|
||||
needs = ["verify"]
|
||||
skill = "artifact-format"
|
||||
description = """
|
||||
Mark work as complete.
|
||||
|
||||
Actions:
|
||||
- bd update {{bead_id}} --notes="Implementation complete"
|
||||
- bd close {{bead_id}} --reason="Completed: {{title}}"
|
||||
- bd sync && git push
|
||||
"""
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/internal/mail/router.go b/internal/mail/router.go
|
||||
--- a/internal/mail/router.go
|
||||
+++ b/internal/mail/router.go
|
||||
@@ -315,7 +315,10 @@ func agentBeadToAddress(bead *agentBead) string {
|
||||
}
|
||||
|
||||
// For other hq- agents, fall back to description parsing
|
||||
- return parseAgentAddressFromDescription(bead.Description)
|
||||
+ if bead.Title != "" && strings.Contains(bead.Title, "/") {
|
||||
+ return bead.Title
|
||||
+ }
|
||||
+ return parseAgentAddressFromDescription(bead.Description)
|
||||
}
|
||||
|
||||
// Handle gt- prefixed IDs (legacy format)
|
||||
@@ -0,0 +1,35 @@
|
||||
diff --git a/internal/mail/router.go b/internal/mail/router.go
|
||||
--- a/internal/mail/router.go
|
||||
+++ b/internal/mail/router.go
|
||||
@@ -330,8 +330,29 @@ func agentBeadToAddress(bead *agentBead) string {
|
||||
}
|
||||
|
||||
// Handle gt- prefixed IDs (legacy format)
|
||||
- if !strings.HasPrefix(id, "gt-") {
|
||||
- return "" // Not a valid agent bead ID
|
||||
+ // Handle rig-specific prefixes: <prefix>-<rig>-<role>-<name>
|
||||
+ // Examples: j-java-crew-americano -> java/crew/americano
|
||||
+ idParts := strings.Split(id, "-")
|
||||
+ if len(idParts) >= 3 {
|
||||
+ for i, part := range idParts {
|
||||
+ if part == "crew" || part == "polecat" || part == "polecats" {
|
||||
+ if i >= 1 && i < len(idParts)-1 {
|
||||
+ rig := idParts[i-1]
|
||||
+ name := strings.Join(idParts[i+1:], "-")
|
||||
+ return rig + "/" + part + "/" + name
|
||||
+ }
|
||||
+ }
|
||||
+ if part == "witness" || part == "refinery" {
|
||||
+ if i >= 1 {
|
||||
+ return idParts[i-1] + "/" + part
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Handle gt- prefixed IDs (legacy format)
|
||||
+ if !strings.HasPrefix(id, "gt-") {
|
||||
+ return "" // Not a valid agent bead ID
|
||||
}
|
||||
|
||||
// Strip prefix
|
||||
25
home/roles/development/gastown-fix-copydir-symlinks.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
diff --git a/internal/git/git.go b/internal/git/git.go
|
||||
--- a/internal/git/git.go
|
||||
+++ b/internal/git/git.go
|
||||
@@ -73,7 +73,19 @@ func copyDir(src, dest string) error {
|
||||
srcPath := filepath.Join(src, entry.Name())
|
||||
destPath := filepath.Join(dest, entry.Name())
|
||||
|
||||
- if entry.IsDir() {
|
||||
+ // Handle symlinks (recreate them, do not follow)
|
||||
+ if entry.Type()&os.ModeSymlink != 0 {
|
||||
+ linkTarget, err := os.Readlink(srcPath)
|
||||
+ if err != nil {
|
||||
+ return err
|
||||
+ }
|
||||
+ if err := os.Symlink(linkTarget, destPath); err != nil {
|
||||
+ return err
|
||||
+ }
|
||||
+ continue
|
||||
+ }
|
||||
+
|
||||
+ if entry.IsDir() {
|
||||
if err := copyDir(srcPath, destPath); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
18
home/roles/development/gastown-fix-role-home-paths.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
diff --git a/internal/cmd/role.go b/internal/cmd/role.go
|
||||
--- a/internal/cmd/role.go
|
||||
+++ b/internal/cmd/role.go
|
||||
@@ -326,11 +326,11 @@ func getRoleHome(role Role, rig, polecat, townRoot string) string {
|
||||
if rig == "" || polecat == "" {
|
||||
return ""
|
||||
}
|
||||
- return filepath.Join(townRoot, rig, "polecats", polecat, "rig")
|
||||
+ return filepath.Join(townRoot, rig, "polecats", polecat)
|
||||
case RoleCrew:
|
||||
if rig == "" || polecat == "" {
|
||||
return ""
|
||||
}
|
||||
- return filepath.Join(townRoot, rig, "crew", polecat, "rig")
|
||||
+ return filepath.Join(townRoot, rig, "crew", polecat)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
18
home/roles/development/gastown-fix-town-root-detection.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
diff --git a/internal/cmd/prime.go b/internal/cmd/prime.go
|
||||
--- a/internal/cmd/prime.go
|
||||
+++ b/internal/cmd/prime.go
|
||||
@@ -276,11 +276,12 @@ func detectRole(cwd, townRoot string) RoleInfo {
|
||||
|
||||
// Check for mayor role
|
||||
// At town root, or in mayor/ or mayor/rig/
|
||||
if relPath == "." || relPath == "" {
|
||||
- ctx.Role = RoleMayor
|
||||
- return ctx
|
||||
+ return ctx // RoleUnknown - town root is shared space
|
||||
}
|
||||
+
|
||||
+ // Check for mayor role: mayor/ or mayor/rig/
|
||||
if len(parts) >= 1 && parts[0] == "mayor" {
|
||||
ctx.Role = RoleMayor
|
||||
return ctx
|
||||
}
|
||||
13
home/roles/development/gastown-fix-validate-recipient.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/internal/mail/router.go b/internal/mail/router.go
|
||||
index b864c069..4b6a045b 100644
|
||||
--- a/internal/mail/router.go
|
||||
+++ b/internal/mail/router.go
|
||||
@@ -646,7 +646,7 @@ func (r *Router) validateRecipient(identity string) error {
|
||||
}
|
||||
|
||||
for _, agent := range agents {
|
||||
- if agentBeadToAddress(agent) == identity {
|
||||
+ if AddressToIdentity(agentBeadToAddress(agent)) == AddressToIdentity(identity) {
|
||||
return nil // Found matching agent
|
||||
}
|
||||
}
|
||||
135
home/roles/development/gastown-statusline-optimization.patch
Normal file
@@ -0,0 +1,135 @@
|
||||
diff --git a/internal/cmd/statusline.go b/internal/cmd/statusline.go
|
||||
index 2edf1be8..00253eea 100644
|
||||
--- a/internal/cmd/statusline.go
|
||||
+++ b/internal/cmd/statusline.go
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
+ "time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/beads"
|
||||
@@ -14,6 +15,37 @@ import (
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
"github.com/steveyegge/gastown/internal/workspace"
|
||||
)
|
||||
+// statusLineCacheTTL is how long cached status output remains valid.
|
||||
+const statusLineCacheTTL = 10 * time.Second
|
||||
+
|
||||
+// statusLineCachePath returns the cache file path for a session.
|
||||
+func statusLineCachePath(session string) string {
|
||||
+ return filepath.Join(os.TempDir(), fmt.Sprintf("gt-status-%s", session))
|
||||
+}
|
||||
+
|
||||
+// getStatusLineCache returns cached status if fresh, empty string otherwise.
|
||||
+func getStatusLineCache(session string) string {
|
||||
+ path := statusLineCachePath(session)
|
||||
+ info, err := os.Stat(path)
|
||||
+ if err != nil {
|
||||
+ return ""
|
||||
+ }
|
||||
+ if time.Since(info.ModTime()) > statusLineCacheTTL {
|
||||
+ return ""
|
||||
+ }
|
||||
+ data, err := os.ReadFile(path)
|
||||
+ if err != nil {
|
||||
+ return ""
|
||||
+ }
|
||||
+ return string(data)
|
||||
+}
|
||||
+
|
||||
+// setStatusLineCache writes status to cache file.
|
||||
+func setStatusLineCache(session, status string) {
|
||||
+ path := statusLineCachePath(session)
|
||||
+ _ = os.WriteFile(path, []byte(status), 0644)
|
||||
+}
|
||||
+
|
||||
|
||||
var (
|
||||
statusLineSession string
|
||||
@@ -34,6 +66,19 @@ func init() {
|
||||
func runStatusLine(cmd *cobra.Command, args []string) error {
|
||||
t := tmux.NewTmux()
|
||||
|
||||
+ // Optimization: skip expensive beads queries for detached sessions
|
||||
+ if statusLineSession != "" {
|
||||
+ if !t.IsSessionAttached(statusLineSession) {
|
||||
+ fmt.Print("○ |")
|
||||
+ return nil
|
||||
+ }
|
||||
+ // Check cache for attached sessions too
|
||||
+ if cached := getStatusLineCache(statusLineSession); cached != "" {
|
||||
+ fmt.Print(cached)
|
||||
+ return nil
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// Get session environment
|
||||
var rigName, polecat, crew, issue, role string
|
||||
|
||||
@@ -150,7 +195,11 @@ func runWorkerStatusLine(t *tmux.Tmux, session, rigName, polecat, crew, issue st
|
||||
|
||||
// Output
|
||||
if len(parts) > 0 {
|
||||
- fmt.Print(strings.Join(parts, " | ") + " |")
|
||||
+ output := strings.Join(parts, " | ") + " |"
|
||||
+ if statusLineSession != "" {
|
||||
+ setStatusLineCache(statusLineSession, output)
|
||||
+ }
|
||||
+ fmt.Print(output)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -389,7 +438,11 @@ func runMayorStatusLine(t *tmux.Tmux) error {
|
||||
}
|
||||
}
|
||||
|
||||
- fmt.Print(strings.Join(parts, " | ") + " |")
|
||||
+ output := strings.Join(parts, " | ") + " |"
|
||||
+ if statusLineSession != "" {
|
||||
+ setStatusLineCache(statusLineSession, output)
|
||||
+ }
|
||||
+ fmt.Print(output)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -458,7 +511,11 @@ func runDeaconStatusLine(t *tmux.Tmux) error {
|
||||
}
|
||||
}
|
||||
|
||||
- fmt.Print(strings.Join(parts, " | ") + " |")
|
||||
+ output := strings.Join(parts, " | ") + " |"
|
||||
+ if statusLineSession != "" {
|
||||
+ setStatusLineCache(statusLineSession, output)
|
||||
+ }
|
||||
+ fmt.Print(output)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -526,7 +583,11 @@ func runWitnessStatusLine(t *tmux.Tmux, rigName string) error {
|
||||
}
|
||||
}
|
||||
|
||||
- fmt.Print(strings.Join(parts, " | ") + " |")
|
||||
+ output := strings.Join(parts, " | ") + " |"
|
||||
+ if statusLineSession != "" {
|
||||
+ setStatusLineCache(statusLineSession, output)
|
||||
+ }
|
||||
+ fmt.Print(output)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -617,7 +678,11 @@ func runRefineryStatusLine(t *tmux.Tmux, rigName string) error {
|
||||
}
|
||||
}
|
||||
|
||||
- fmt.Print(strings.Join(parts, " | ") + " |")
|
||||
+ output := strings.Join(parts, " | ") + " |"
|
||||
+ if statusLineSession != "" {
|
||||
+ setStatusLineCache(statusLineSession, output)
|
||||
+ }
|
||||
+ fmt.Print(output)
|
||||
return nil
|
||||
}
|
||||
|
||||
230
home/roles/development/skills/bd_workflow.md
Normal file
@@ -0,0 +1,230 @@
|
||||
---
|
||||
description: How to use the bd (beads) CLI for issue tracking, dependencies, and workflow orchestration
|
||||
---
|
||||
|
||||
# BD Workflow
|
||||
|
||||
The `bd` CLI is a git-backed issue tracker with first-class dependency support. Use it for multi-session work, blocking relationships, and persistent memory across conversation compaction.
|
||||
|
||||
## When to Use BD vs TodoWrite
|
||||
|
||||
| Use BD | Use TodoWrite |
|
||||
|--------|---------------|
|
||||
| Work spans multiple sessions | Single-session tasks |
|
||||
| Dependencies between tasks | Independent subtasks |
|
||||
| Need audit trail in git | Ephemeral tracking |
|
||||
| Cross-repo coordination | Local project only |
|
||||
| Resuming after compaction | Simple task lists |
|
||||
|
||||
## Core Commands
|
||||
|
||||
### Creating Issues
|
||||
|
||||
```bash
|
||||
bd create "Issue title" # Basic task
|
||||
bd create "Bug title" --type=bug --priority=1 # P1 bug
|
||||
bd create "Feature" --type=feature -d "Details" # With description
|
||||
bd q "Quick capture" # Output only ID
|
||||
```
|
||||
|
||||
### Managing Issues
|
||||
|
||||
```bash
|
||||
bd show <id> # View issue details
|
||||
bd show <id> --children # View children of epic
|
||||
bd list # List open issues (default 50)
|
||||
bd list --all # Include closed
|
||||
bd list -s in_progress # Filter by status
|
||||
bd list -t bug -p 0 # P0 bugs
|
||||
bd list --pretty # Tree format
|
||||
```
|
||||
|
||||
### Updating Issues
|
||||
|
||||
```bash
|
||||
bd update <id> --status=in_progress # Start work
|
||||
bd update <id> --status=blocked # Mark blocked
|
||||
bd update <id> --claim # Claim atomically
|
||||
bd update <id> --add-label=urgent # Add label
|
||||
bd update <id> -d "New description" # Update description
|
||||
```
|
||||
|
||||
### Closing Issues
|
||||
|
||||
```bash
|
||||
bd close <id> # Close issue
|
||||
bd close <id> --continue # Auto-advance to next step
|
||||
bd close <id> --suggest-next # Show newly unblocked
|
||||
```
|
||||
|
||||
## Finding Work
|
||||
|
||||
```bash
|
||||
bd ready # Ready issues (no blockers)
|
||||
bd ready --mol <mol-id> # Ready steps in molecule
|
||||
bd ready -n 5 # Limit to 5
|
||||
bd ready --assignee me # Assigned to me
|
||||
bd blocked # Show blocked issues
|
||||
bd blocked --parent <id> # Blocked within epic
|
||||
```
|
||||
|
||||
## Dependency Management
|
||||
|
||||
### Creating Dependencies
|
||||
|
||||
```bash
|
||||
bd dep <blocker> --blocks <blocked> # A blocks B
|
||||
bd dep add <blocked> <blocker> # Same as above
|
||||
bd dep relate <id1> <id2> # Bidirectional link
|
||||
```
|
||||
|
||||
### Viewing Dependencies
|
||||
|
||||
```bash
|
||||
bd dep list <id> # Show dependencies
|
||||
bd dep tree <id> # Dependency tree
|
||||
bd dep cycles # Detect cycles
|
||||
```
|
||||
|
||||
### Removing Dependencies
|
||||
|
||||
```bash
|
||||
bd dep remove <blocked> <blocker> # Remove dependency
|
||||
bd dep unrelate <id1> <id2> # Remove relation
|
||||
```
|
||||
|
||||
## Sync Workflow
|
||||
|
||||
BD syncs issues via git. The daemon handles this automatically, but manual sync is available:
|
||||
|
||||
```bash
|
||||
bd sync # Full sync (pull, merge, push)
|
||||
bd sync --flush-only # Export to JSONL only
|
||||
bd sync --import-only # Import from JSONL only
|
||||
bd sync --status # Show sync branch diff
|
||||
bd sync --squash # Accumulate without commit
|
||||
```
|
||||
|
||||
## Formula and Molecule Workflow
|
||||
|
||||
Formulas are reusable workflow templates. Molecules are instantiated workflows.
|
||||
|
||||
### Formulas
|
||||
|
||||
```bash
|
||||
bd formula list # List available formulas
|
||||
bd formula list --type=workflow # Filter by type
|
||||
bd formula show <name> # Show formula details
|
||||
bd cook <formula> # Compile to proto (stdout)
|
||||
bd cook <formula> --var name=auth # With variable substitution
|
||||
bd cook <formula> --dry-run # Preview steps
|
||||
bd cook <formula> --persist # Save to database
|
||||
```
|
||||
|
||||
### Molecules: Pour vs Wisp
|
||||
|
||||
| pour (persistent) | wisp (ephemeral) |
|
||||
|-------------------|------------------|
|
||||
| Feature implementations | Release workflows |
|
||||
| Multi-session work | Patrol cycles |
|
||||
| Audit trail needed | Health checks |
|
||||
| Git-synced | Local only |
|
||||
|
||||
```bash
|
||||
# Persistent molecule (liquid phase)
|
||||
bd mol pour <proto> --var name=auth
|
||||
|
||||
# Ephemeral molecule (vapor phase)
|
||||
bd mol wisp <proto> --var version=1.0
|
||||
bd mol wisp list # List wisps
|
||||
bd mol wisp gc # Garbage collect
|
||||
```
|
||||
|
||||
### Tracking Molecule Progress
|
||||
|
||||
```bash
|
||||
bd mol show <mol-id> # Show structure
|
||||
bd mol show <mol-id> --parallel # Parallelizable steps
|
||||
bd mol current # Where am I?
|
||||
bd mol current <mol-id> # Status for molecule
|
||||
bd mol progress <mol-id> # Progress summary + ETA
|
||||
```
|
||||
|
||||
### Molecule Lifecycle
|
||||
|
||||
```bash
|
||||
bd mol squash <mol-id> # Condense to digest
|
||||
bd mol burn <mol-id> # Delete wisp
|
||||
bd mol distill <epic-id> # Extract formula from epic
|
||||
```
|
||||
|
||||
## Gates and Human Checkpoints
|
||||
|
||||
Gates are async wait conditions that block workflow steps:
|
||||
|
||||
| Gate Type | Wait Condition |
|
||||
|-----------|---------------|
|
||||
| human | Manual `bd close` |
|
||||
| timer | Timeout expires |
|
||||
| gh:run | GitHub workflow completes |
|
||||
| gh:pr | PR merges |
|
||||
| bead | Cross-rig bead closes |
|
||||
|
||||
```bash
|
||||
bd gate list # Show open gates
|
||||
bd gate list --all # Include closed
|
||||
bd gate check # Evaluate all gates
|
||||
bd gate check --type=bead # Check bead gates only
|
||||
bd gate resolve <id> # Close manually
|
||||
```
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Starting Work on a Bead
|
||||
|
||||
```bash
|
||||
bd update <id> --status=in_progress
|
||||
# ... do work ...
|
||||
bd close <id>
|
||||
```
|
||||
|
||||
### Creating Related Issues
|
||||
|
||||
```bash
|
||||
bd create "Main task" --deps "blocks:<other-id>"
|
||||
bd dep add <new-id> <blocker-id>
|
||||
```
|
||||
|
||||
### Working Through a Molecule
|
||||
|
||||
```bash
|
||||
bd mol pour my-workflow --var name=feature
|
||||
bd ready --mol <mol-id> # Find next step
|
||||
bd update <step-id> --claim # Claim step
|
||||
# ... do work ...
|
||||
bd close <step-id> --continue # Close and advance
|
||||
```
|
||||
|
||||
### Quick Status Check
|
||||
|
||||
```bash
|
||||
bd ready -n 3 # Top 3 ready items
|
||||
bd list -s in_progress # What's in flight?
|
||||
bd blocked # What's stuck?
|
||||
```
|
||||
|
||||
## Useful Flags
|
||||
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `--json` | JSON output for scripting |
|
||||
| `--quiet` | Suppress non-essential output |
|
||||
| `--dry-run` | Preview without executing |
|
||||
| `--pretty` | Tree format display |
|
||||
|
||||
## Integration Notes
|
||||
|
||||
- BD auto-syncs via daemon (check with `bd info`)
|
||||
- Issues stored in `.beads/` directory
|
||||
- JSONL files sync through git
|
||||
- Use `bd doctor` if something seems wrong
|
||||
123
home/roles/development/skills/micro/artifact-format.md
Normal file
@@ -0,0 +1,123 @@
|
||||
---
|
||||
description: How to structure research and plan artifacts in thoughts/
|
||||
---
|
||||
|
||||
# Artifact Format
|
||||
|
||||
Standardized format for thoughts/ artifacts. All beads-related artifacts should follow these conventions for consistency and machine parseability.
|
||||
|
||||
## Frontmatter (Required)
|
||||
|
||||
Every artifact MUST include YAML frontmatter:
|
||||
|
||||
```yaml
|
||||
---
|
||||
date: 2026-01-15T10:00:00-08:00 # ISO 8601 with timezone
|
||||
bead_id: project-abc # Bead identifier
|
||||
bead_title: "Title of the bead" # Human-readable title
|
||||
author: claude # Who created this
|
||||
git_commit: abc123def # Commit hash at creation
|
||||
branch: main # Branch name
|
||||
repository: repo-name # Repository name
|
||||
status: draft|complete # Artifact status
|
||||
---
|
||||
```
|
||||
|
||||
### Gathering Metadata
|
||||
|
||||
```bash
|
||||
git rev-parse HEAD # Current commit
|
||||
git branch --show-current # Current branch
|
||||
basename $(git rev-parse --show-toplevel) # Repo name
|
||||
date -Iseconds # ISO timestamp
|
||||
```
|
||||
|
||||
## Research Artifact Structure
|
||||
|
||||
Location: `thoughts/beads-{bead-id}/research.md`
|
||||
|
||||
```markdown
|
||||
# Research: {bead title}
|
||||
|
||||
**Bead**: {bead-id}
|
||||
**Date**: {timestamp}
|
||||
**Git Commit**: {commit hash}
|
||||
|
||||
## Research Question
|
||||
{Original question from bead description}
|
||||
|
||||
## Summary
|
||||
{2-3 sentence overview answering the research question}
|
||||
|
||||
## Key Discoveries
|
||||
- {Finding with file:line reference}
|
||||
- {Pattern or convention found}
|
||||
- {Architectural decision documented}
|
||||
|
||||
## Architecture
|
||||
{Current patterns and conventions in the codebase}
|
||||
|
||||
## Code References
|
||||
- `path/to/file.py:123` - Description of relevance
|
||||
- `another/file.ts:45-67` - Description of relevance
|
||||
|
||||
## Open Questions
|
||||
{Areas needing further investigation or human clarification}
|
||||
```
|
||||
|
||||
## Plan Artifact Structure
|
||||
|
||||
Location: `thoughts/beads-{bead-id}/plan.md`
|
||||
|
||||
```markdown
|
||||
# {Title} Implementation Plan
|
||||
|
||||
## Overview
|
||||
{What we're implementing and why - 1-2 sentences}
|
||||
|
||||
## Current State
|
||||
{What exists now, key constraints discovered}
|
||||
|
||||
### Key Discoveries
|
||||
- {Finding with file:line reference}
|
||||
- {Pattern to follow}
|
||||
|
||||
## Desired End State
|
||||
{Specification of what success looks like}
|
||||
|
||||
## What We're NOT Doing
|
||||
{Explicitly list out-of-scope items}
|
||||
|
||||
## Phase 1: {Descriptive Name}
|
||||
|
||||
### Overview
|
||||
{What this phase accomplishes}
|
||||
|
||||
### Changes
|
||||
- [ ] {Specific change with file path}
|
||||
- [ ] {Another change}
|
||||
|
||||
### Success Criteria
|
||||
|
||||
#### Automated
|
||||
- [ ] Tests pass: `{test command}`
|
||||
- [ ] Lint passes: `{lint command}`
|
||||
|
||||
#### Manual
|
||||
- [ ] {Human verification step}
|
||||
|
||||
## Phase 2: {Descriptive Name}
|
||||
{Repeat structure...}
|
||||
|
||||
## References
|
||||
- Bead: {bead-id}
|
||||
- Research: `thoughts/beads-{bead-id}/research.md`
|
||||
```
|
||||
|
||||
## Key Principles
|
||||
|
||||
1. **Always include file:line references** - Makes artifacts actionable
|
||||
2. **Separate automated vs manual verification** - Enables agent autonomy
|
||||
3. **Use checkboxes for phases** - Enables resumability after interruption
|
||||
4. **Keep frontmatter machine-parseable** - Enables tooling integration
|
||||
5. **Link related artifacts** - Research links to plan, plan links to bead
|
||||
121
home/roles/development/skills/micro/planning.md
Normal file
@@ -0,0 +1,121 @@
|
||||
---
|
||||
description: How to create effective implementation plans with phased delivery and clear success criteria
|
||||
---
|
||||
|
||||
# Planning
|
||||
|
||||
Create implementation plans that enable incremental, verifiable progress.
|
||||
|
||||
## Core Principles
|
||||
|
||||
1. **Incremental delivery**: Each phase should produce working, testable changes
|
||||
2. **Clear checkpoints**: Success criteria that can be verified without ambiguity
|
||||
3. **Buy-in before detail**: Confirm understanding and approach before writing specifics
|
||||
4. **Explicit scope**: State what we're NOT doing to prevent scope creep
|
||||
|
||||
## Plan Document Structure
|
||||
|
||||
```markdown
|
||||
# {Feature} Implementation Plan
|
||||
|
||||
## Overview
|
||||
{1-2 sentences: what we're building and why}
|
||||
|
||||
## Current State Analysis
|
||||
{What exists now, key constraints, file:line references}
|
||||
|
||||
## Desired End State
|
||||
{Specification of outcome and how to verify it}
|
||||
|
||||
## What We're NOT Doing
|
||||
{Explicit out-of-scope items}
|
||||
|
||||
## Phase 1: {Descriptive Name}
|
||||
### Overview
|
||||
{What this phase accomplishes - should be independently valuable}
|
||||
|
||||
### Changes Required
|
||||
{Specific files and modifications with code snippets}
|
||||
|
||||
### Success Criteria
|
||||
#### Automated Verification
|
||||
- [ ] Tests pass: `{test command}`
|
||||
- [ ] Lint passes: `{lint command}`
|
||||
|
||||
#### Manual Verification
|
||||
- [ ] {Human-observable outcome}
|
||||
|
||||
## Testing Strategy
|
||||
{Unit tests, integration tests, manual testing steps}
|
||||
|
||||
## References
|
||||
{Links to research, related files, similar implementations}
|
||||
```
|
||||
|
||||
## Phase Design
|
||||
|
||||
Good phases are:
|
||||
- **Self-contained**: Completable in one session
|
||||
- **Testable**: Has clear pass/fail criteria
|
||||
- **Reversible**: Can be rolled back if needed
|
||||
- **Incremental**: Builds on previous phases without requiring all phases
|
||||
|
||||
Bad phases are:
|
||||
- "Refactor everything" (too broad)
|
||||
- "Add helper function" (too granular)
|
||||
- Phases that only work if ALL phases complete
|
||||
|
||||
## Success Criteria Guidelines
|
||||
|
||||
**Automated Verification** (agent-runnable):
|
||||
- Test commands: `make test`, `npm test`, `nix flake check`
|
||||
- Lint/format: `make lint`, `cargo fmt --check`
|
||||
- Type checking: `make typecheck`, `tsc --noEmit`
|
||||
- Build verification: `make build`, `nix build`
|
||||
|
||||
**Manual Verification** (requires human):
|
||||
- UI/UX functionality and appearance
|
||||
- Performance under realistic conditions
|
||||
- Edge cases hard to automate
|
||||
- Integration with external systems
|
||||
|
||||
**From Contribution Guidelines** (if CONTRIBUTING.md exists):
|
||||
- Include any testing requirements specified
|
||||
- Reference the guideline: "Per CONTRIBUTING.md: {requirement}"
|
||||
|
||||
## Presenting Understanding
|
||||
|
||||
Before writing the plan, confirm alignment:
|
||||
|
||||
```
|
||||
Based on the requirements and my research, I understand we need to [summary].
|
||||
|
||||
I've found that:
|
||||
- [Current implementation detail with file:line]
|
||||
- [Relevant pattern or constraint]
|
||||
- [Potential complexity identified]
|
||||
|
||||
Questions my research couldn't answer:
|
||||
- [Specific technical question requiring judgment]
|
||||
```
|
||||
|
||||
Only ask questions you genuinely cannot answer through code investigation.
|
||||
|
||||
## Design Options Pattern
|
||||
|
||||
When multiple approaches exist:
|
||||
|
||||
```
|
||||
**Design Options:**
|
||||
1. [Option A] - [1-sentence description]
|
||||
- Pro: [benefit]
|
||||
- Con: [drawback]
|
||||
|
||||
2. [Option B] - [1-sentence description]
|
||||
- Pro: [benefit]
|
||||
- Con: [drawback]
|
||||
|
||||
Which approach aligns best with [relevant consideration]?
|
||||
```
|
||||
|
||||
Get buy-in on approach before detailing phases.
|
||||
68
home/roles/development/skills/micro/pr-description.md
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
description: How to write comprehensive PR descriptions that help reviewers understand changes
|
||||
---
|
||||
|
||||
# PR Description
|
||||
|
||||
Write PR descriptions that help reviewers understand what changed and why.
|
||||
|
||||
## Structure
|
||||
|
||||
Use this standard structure for PR descriptions:
|
||||
|
||||
```markdown
|
||||
## Summary
|
||||
<1-3 bullet points of what changed and why>
|
||||
|
||||
## Context
|
||||
<Why this change was needed - the problem being solved>
|
||||
<Link to related issues/tickets>
|
||||
|
||||
## Changes
|
||||
<Detailed breakdown by area/component>
|
||||
- Area 1: What changed and why
|
||||
- Area 2: What changed and why
|
||||
|
||||
## Testing
|
||||
<How this was verified>
|
||||
- Automated: Tests added/updated, CI status
|
||||
- Manual: Steps to verify functionality
|
||||
|
||||
## Screenshots (if UI changes)
|
||||
<Before/after screenshots if applicable>
|
||||
```
|
||||
|
||||
## Guidelines
|
||||
|
||||
### Lead with WHY, not WHAT
|
||||
- The diff shows WHAT changed - your description explains WHY
|
||||
- Start with the problem being solved
|
||||
- Explain the approach chosen and alternatives considered
|
||||
|
||||
### Link to context
|
||||
- Reference related issues: `Fixes #123` or `Relates to #456`
|
||||
- Link to design docs or discussions
|
||||
- Mention dependent PRs if any
|
||||
|
||||
### Call out review areas
|
||||
- Highlight areas needing careful review
|
||||
- Note any tricky or non-obvious code
|
||||
- Point out architectural decisions
|
||||
|
||||
### Note breaking changes prominently
|
||||
- Use a dedicated "Breaking Changes" section if applicable
|
||||
- Explain migration path for consumers
|
||||
- List any deprecations
|
||||
|
||||
### Be scannable
|
||||
- Use bullet points over paragraphs
|
||||
- Keep sections focused and concise
|
||||
- Put the most important info first
|
||||
|
||||
## Anti-patterns to Avoid
|
||||
|
||||
- Empty descriptions or just "fixes bug"
|
||||
- Repeating the commit messages verbatim
|
||||
- Including irrelevant implementation details
|
||||
- Missing context on why the change was made
|
||||
- Forgetting to mention breaking changes
|
||||
49
home/roles/development/skills/micro/research-agents.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
description: How to spawn and coordinate research sub-agents
|
||||
---
|
||||
|
||||
# Research Agents
|
||||
|
||||
Use parallel sub-agents for efficient codebase research.
|
||||
|
||||
## Available Agents
|
||||
|
||||
| Agent | Purpose |
|
||||
|-------|---------|
|
||||
| codebase-locator | Find WHERE files and components live |
|
||||
| codebase-analyzer | Understand HOW specific code works |
|
||||
| codebase-pattern-finder | Find examples of existing patterns |
|
||||
| thoughts-locator | Discover relevant documents in thoughts/ |
|
||||
|
||||
## Spawning Protocol
|
||||
|
||||
1. **Decompose** - Break the research question into 3-5 specific questions
|
||||
2. **Spawn parallel** - Use one Task call with multiple agents
|
||||
3. **Be specific** - Include directories and file patterns in prompts
|
||||
4. **Wait for all** - Do not synthesize until ALL agents complete
|
||||
5. **Synthesize** - Combine findings into coherent summary with file:line references
|
||||
|
||||
## Example
|
||||
|
||||
```
|
||||
Task(codebase-locator, "Find all files related to authentication in src/")
|
||||
Task(codebase-analyzer, "Explain how JWT tokens are validated in src/auth/")
|
||||
Task(codebase-pattern-finder, "Find examples of middleware patterns in src/")
|
||||
Task(thoughts-locator, "Find documents about auth design decisions in thoughts/")
|
||||
```
|
||||
|
||||
## Key Principles
|
||||
|
||||
- **Parallel when different** - Run agents in parallel when searching for different things
|
||||
- **WHAT not HOW** - Each agent knows its job; tell it what you need, not how to search
|
||||
- **Document, don't evaluate** - Agents should describe what exists, not critique it
|
||||
- **Specific directories** - Always scope searches to relevant directories
|
||||
- **File references** - Include specific file:line references in synthesis
|
||||
|
||||
## Agent Prompts
|
||||
|
||||
When spawning agents, include:
|
||||
- The specific question or goal
|
||||
- Relevant directories to search
|
||||
- Reminder to document (not evaluate) what they find
|
||||
- Request for file:line references in findings
|
||||
112
home/roles/emacs/default.nix
Normal file
@@ -0,0 +1,112 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.emacs;
|
||||
|
||||
doomEmacs = pkgs.fetchFromGitHub {
|
||||
owner = "doomemacs";
|
||||
repo = "doomemacs";
|
||||
rev = "38d94da67dc84897a4318714dcc48494c016d8c4";
|
||||
sha256 = "sha256-Uc6qONH3jjUVDgW+pPBCGC7mh88ZY05u1y37fQrsxq0=";
|
||||
};
|
||||
|
||||
# Shared emacs packages
|
||||
emacsPackages = epkgs: [
|
||||
epkgs.vterm
|
||||
epkgs.treesit-grammars.with-all-grammars
|
||||
];
|
||||
|
||||
# Default emacs configuration with vterm support
|
||||
defaultEmacsPackage =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then pkgs.emacs-macport.pkgs.withPackages emacsPackages
|
||||
else pkgs.emacs.pkgs.withPackages emacsPackages;
|
||||
|
||||
# Path to doom config directory (relative to this file)
|
||||
doomConfigDir = ./doom;
|
||||
in
|
||||
{
|
||||
options.home.roles.emacs = {
|
||||
enable = mkEnableOption "Doom Emacs with vterm and tree-sitter support";
|
||||
|
||||
prebuiltDoom = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Use nix-doom-emacs-unstraightened to pre-build all Doom packages at
|
||||
nix build time. This eliminates the need to run `doom sync` after
|
||||
first boot, making it ideal for live USB images or immutable systems.
|
||||
|
||||
When enabled, the doom configuration is read-only (stored in nix store).
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
# Common configuration for both modes
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.emacs-all-the-icons-fonts
|
||||
pkgs.fira-code
|
||||
pkgs.fontconfig
|
||||
pkgs.graphviz
|
||||
pkgs.isort
|
||||
pkgs.nerd-fonts.fira-code
|
||||
pkgs.nerd-fonts.droid-sans-mono
|
||||
pkgs.nil # nix lsp language server
|
||||
pkgs.nixfmt-rfc-style
|
||||
(pkgs.ripgrep.override {withPCRE2 = true;})
|
||||
pkgs.pipenv
|
||||
pkgs.poetry
|
||||
pkgs.python3
|
||||
];
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
}
|
||||
|
||||
# Standard Doom Emacs mode (requires doom sync at runtime)
|
||||
(mkIf (!cfg.prebuiltDoom) {
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = defaultEmacsPackage;
|
||||
};
|
||||
|
||||
# Mount emacs and tree-sitter grammars from nix store
|
||||
home.file = {
|
||||
"${config.xdg.configHome}/emacs".source = doomEmacs;
|
||||
};
|
||||
|
||||
home.sessionPath = [
|
||||
"${config.xdg.configHome}/emacs/bin"
|
||||
];
|
||||
|
||||
home.sessionVariables = {
|
||||
DOOMDIR = "${config.xdg.configHome}/doom";
|
||||
DOOMLOCALDIR = "${config.xdg.dataHome}/doom";
|
||||
};
|
||||
|
||||
# TODO: Use mkOutOfStoreSymlink instead?
|
||||
home.activation.doomConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
# Always remove and recreate the symlink to ensure it points to the source directory
|
||||
rm -rf "${config.xdg.configHome}/doom"
|
||||
ln -sf "${config.home.homeDirectory}/nixos-configs/home/roles/emacs/doom" "${config.xdg.configHome}/doom"
|
||||
'';
|
||||
})
|
||||
|
||||
# Pre-built Doom Emacs mode (no doom sync needed - ideal for live USB)
|
||||
(mkIf cfg.prebuiltDoom {
|
||||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomDir = doomConfigDir;
|
||||
doomLocalDir = "${config.xdg.dataHome}/doom";
|
||||
# Add extra packages that aren't part of Doom but needed for our config
|
||||
extraPackages = epkgs: [
|
||||
epkgs.vterm
|
||||
epkgs.treesit-grammars.with-all-grammars
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
396
home/roles/emacs/doom/config.el
Normal file
@@ -0,0 +1,396 @@
|
||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
;; sync' after modifying this file!
|
||||
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets. It is optional.
|
||||
;; (setq user-full-name "John Doe"
|
||||
;; user-mail-address "john@doe.com")
|
||||
|
||||
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
||||
;;
|
||||
;; - `doom-font' -- the primary font to use
|
||||
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
||||
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
||||
;; presentations or streaming.
|
||||
;; - `doom-symbol-font' -- for symbols
|
||||
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
||||
;;
|
||||
;; See 'C-h v doom-font' for documentation and more examples of what they
|
||||
;; accept. For example:
|
||||
;;
|
||||
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
|
||||
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
|
||||
;;
|
||||
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
||||
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
||||
;; refresh your font settings. If Emacs still can't find your font, it likely
|
||||
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
||||
(setq doom-font (font-spec :family "Fira Code" :size 16))
|
||||
|
||||
;; Auto-install nerd-icons fonts if they're missing
|
||||
(defun my/ensure-nerd-icons-fonts ()
|
||||
"Check if nerd-icons fonts are installed and install them if missing."
|
||||
(when (display-graphic-p)
|
||||
(unless (find-font (font-spec :name "Symbols Nerd Font Mono"))
|
||||
(when (fboundp 'nerd-icons-install-fonts)
|
||||
(nerd-icons-install-fonts t)))))
|
||||
|
||||
(add-hook 'doom-init-ui-hook #'my/ensure-nerd-icons-fonts)
|
||||
|
||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
||||
;; `load-theme' function. This is the default:
|
||||
(setq doom-theme 'doom-tokyo-night)
|
||||
|
||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||
(setq display-line-numbers-type t)
|
||||
|
||||
;; If you use `org' and don't want your org files in the default location below,
|
||||
;; change `org-directory'. It must be set before org loads!
|
||||
(setq org-directory "~/org/")
|
||||
(after! org
|
||||
;; Skip recurring events past their CALDAV_UNTIL date
|
||||
;; org-caldav ignores UNTIL from RRULE, so we store it as a property
|
||||
;; and filter here in the agenda
|
||||
(defun my/skip-if-past-until ()
|
||||
"Return non-nil if entry has CALDAV_UNTIL and current date is past it."
|
||||
(let ((until-str (org-entry-get nil "CALDAV_UNTIL")))
|
||||
(when (and until-str
|
||||
(string-match "^\\([0-9]\\{4\\}\\)\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)" until-str))
|
||||
(let* ((until-year (string-to-number (match-string 1 until-str)))
|
||||
(until-month (string-to-number (match-string 2 until-str)))
|
||||
(until-day (string-to-number (match-string 3 until-str)))
|
||||
(until-time (encode-time 0 0 0 until-day until-month until-year))
|
||||
(today (current-time)))
|
||||
(when (time-less-p until-time today)
|
||||
(org-end-of-subtree t))))))
|
||||
|
||||
(setq org-agenda-span 'week
|
||||
org-agenda-start-with-log-mode t
|
||||
my-agenda-dirs '("projects" "roam")
|
||||
org-agenda-files (cons org-directory (mapcan (lambda (x) (directory-files-recursively
|
||||
(expand-file-name x org-directory)
|
||||
"\.org$"))
|
||||
my-agenda-dirs))
|
||||
org-log-done 'time
|
||||
org-agenda-skip-function-global #'my/skip-if-past-until
|
||||
org-agenda-custom-commands '(("n" "Agenda"
|
||||
((agenda "")
|
||||
(tags-todo "-someday-recurring")))
|
||||
("s" "Someday Items"
|
||||
((tags-todo "+someday"))))
|
||||
org-todo-keywords '((sequence "TODO(t)" "IN-PROGRESS(p)" "WAIT(w)" "|" "DONE(d)" "KILL(k)"))
|
||||
org-journal-file-type 'weekly
|
||||
org-journal-file-format "%Y-%m-%d.org"
|
||||
org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "~/org/todo.org" "Inbox")
|
||||
"* TODO %? \n %i \n%a" :prepend t)))
|
||||
;; Make blocked tasks more visible in agenda (they have subtasks to do!)
|
||||
(custom-set-faces!
|
||||
'(org-agenda-dimmed-todo-face :foreground "#bb9af7" :weight normal)))
|
||||
|
||||
(map! :after org-agenda
|
||||
:map org-agenda-mode-map
|
||||
:localleader
|
||||
(:prefix ("v" . "view")
|
||||
"d" #'org-agenda-day-view
|
||||
"w" #'org-agenda-week-view))
|
||||
|
||||
;; org-caldav: Sync Org entries with Nextcloud CalDAV
|
||||
;; Setup requirements:
|
||||
;; 1. Create Nextcloud app password: Settings -> Security -> Devices & sessions
|
||||
;; 2. Store in rbw: rbw add nextcloud-caldav (put app password as the secret)
|
||||
;; 3. Run: doom sync
|
||||
;; 4. Test: M-x my/org-caldav-sync-with-rbw (or SPC o a s)
|
||||
;;
|
||||
;; Note: Conflict resolution is "Org always wins" - treat Org as source of truth
|
||||
;; for entries that originated in Org.
|
||||
|
||||
;; Define sync wrapper before use-package (so keybinding works)
|
||||
(defun my/org-caldav-sync-with-rbw ()
|
||||
"Run org-caldav-sync with credentials from rbw embedded in URL."
|
||||
(interactive)
|
||||
(require 'org)
|
||||
(require 'org-caldav)
|
||||
(let* ((password (my/get-rbw-password "nextcloud-caldav"))
|
||||
;; Embed credentials in URL (url-encode password in case of special chars)
|
||||
(encoded-pass (url-hexify-string password)))
|
||||
(setq org-caldav-url
|
||||
(format "https://johno:%s@nextcloud.johnogle.info/remote.php/dav/calendars/johno"
|
||||
encoded-pass))
|
||||
(org-caldav-sync)))
|
||||
|
||||
(use-package! org-caldav
|
||||
:after org
|
||||
:commands (org-caldav-sync my/org-caldav-sync-with-rbw)
|
||||
:init
|
||||
(map! :leader
|
||||
(:prefix ("o" . "open")
|
||||
(:prefix ("a" . "agenda/calendar")
|
||||
:desc "Sync CalDAV" "s" #'my/org-caldav-sync-with-rbw)))
|
||||
:config
|
||||
;; Nextcloud CalDAV base URL (credentials added dynamically by sync wrapper)
|
||||
(setq org-caldav-url "https://nextcloud.johnogle.info/remote.php/dav/calendars/johno")
|
||||
|
||||
;; Timezone for iCalendar export
|
||||
(setq org-icalendar-timezone "America/Los_Angeles")
|
||||
|
||||
;; Sync state storage (in org directory for multi-machine sync)
|
||||
(setq org-caldav-save-directory (expand-file-name ".org-caldav/" org-directory))
|
||||
|
||||
;; Backup file for entries before modification
|
||||
(setq org-caldav-backup-file (expand-file-name ".org-caldav/backup.org" org-directory))
|
||||
|
||||
;; Limit past events to 30 days (avoids uploading years of scheduled tasks)
|
||||
(setq org-caldav-days-in-past 30)
|
||||
|
||||
;; Sync behavior: bidirectional by default
|
||||
(setq org-caldav-sync-direction 'twoway)
|
||||
|
||||
;; What changes from calendar sync back to Org (conservative: title and timestamp only)
|
||||
(setq org-caldav-sync-changes-to-org 'title-and-timestamp)
|
||||
|
||||
;; Deletion handling: never auto-delete to prevent accidental mass deletion
|
||||
(setq org-caldav-delete-calendar-entries 'never)
|
||||
(setq org-caldav-delete-org-entries 'never)
|
||||
|
||||
;; Enable TODO/VTODO sync
|
||||
(setq org-icalendar-include-todo 'all)
|
||||
(setq org-caldav-sync-todo t)
|
||||
|
||||
;; Map VTODO percent-complete to org-todo-keywords
|
||||
;; Format: (PERCENT "KEYWORD") - percent thresholds map to states
|
||||
(setq org-caldav-todo-percent-states
|
||||
'((0 "TODO")
|
||||
(25 "WAIT")
|
||||
(50 "IN-PROGRESS")
|
||||
(100 "DONE")
|
||||
(100 "KILL")))
|
||||
|
||||
;; Allow export with broken links (mu4e links can't be resolved during export)
|
||||
(setq org-export-with-broken-links 'mark)
|
||||
|
||||
;; Calendar-specific configuration
|
||||
(setq org-caldav-calendars
|
||||
'(;; Personal calendar: two-way sync with family-shared Nextcloud calendar
|
||||
(:calendar-id "personal"
|
||||
:inbox "~/org/personal-calendar.org"
|
||||
:files ("~/org/personal-calendar.org"))
|
||||
|
||||
;; Tasks calendar: one-way sync (org → calendar only)
|
||||
;; SCHEDULED/DEADLINE items from todo.org push to private Tasks calendar.
|
||||
;; No inbox = no download from calendar (effectively one-way).
|
||||
;; Note: Create 'tasks' calendar in Nextcloud first, keep it private.
|
||||
(:calendar-id "tasks"
|
||||
:files ("~/org/todo.org"))))
|
||||
|
||||
;; Handle UNTIL in recurring events
|
||||
;; org-caldav ignores UNTIL from RRULE - events repeat forever.
|
||||
;; This advice extracts UNTIL and stores it as a property for agenda filtering.
|
||||
(defun my/org-caldav-add-until-property (orig-fun eventdata-alist)
|
||||
"Advice to store CALDAV_UNTIL property for recurring events."
|
||||
(let ((result (funcall orig-fun eventdata-alist)))
|
||||
(let* ((rrule-props (alist-get 'rrule-props eventdata-alist))
|
||||
(until-str (cadr (assoc 'UNTIL rrule-props)))
|
||||
(summary (alist-get 'summary eventdata-alist)))
|
||||
;; Debug: log what we're seeing
|
||||
(message "CALDAV-DEBUG: %s | rrule-props: %S | until: %s"
|
||||
(or summary "?") rrule-props until-str)
|
||||
(when until-str
|
||||
(save-excursion
|
||||
(org-back-to-heading t)
|
||||
(org-entry-put nil "CALDAV_UNTIL" until-str))))
|
||||
result))
|
||||
|
||||
(advice-add 'org-caldav-insert-org-event-or-todo
|
||||
:around #'my/org-caldav-add-until-property)
|
||||
)
|
||||
|
||||
(defun my/get-rbw-password (alias &optional no-error)
|
||||
"Return the password for ALIAS via rbw, unlocking the vault only if needed.
|
||||
If NO-ERROR is non-nil, return nil instead of signaling an error when
|
||||
rbw is unavailable or the entry is not found."
|
||||
(if (not (executable-find "rbw"))
|
||||
(if no-error
|
||||
nil
|
||||
(user-error "rbw: not installed or not in PATH"))
|
||||
(let* ((cmd (format "rbw get %s 2>/dev/null" (shell-quote-argument alias)))
|
||||
(output (string-trim (shell-command-to-string cmd))))
|
||||
(if (string-empty-p output)
|
||||
(if no-error
|
||||
nil
|
||||
(user-error "rbw: no entry found for '%s' - run: rbw add %s" alias alias))
|
||||
output))))
|
||||
|
||||
(after! gptel
|
||||
:config
|
||||
(setq! gptel-api-key (my/get-rbw-password "openai-api-key-chatgpt-el" t)
|
||||
gptel-default-mode 'org-mode
|
||||
gptel-use-tools t
|
||||
gptel-confirm-tool-calls 'always
|
||||
gptel-include-reasoning 'ignore
|
||||
gptel-model "qwen3:30b")
|
||||
|
||||
;; Set default backend to be Ollama-Local
|
||||
(setq! gptel-backend
|
||||
(gptel-make-ollama "Ollama-Local"
|
||||
:host "localhost:11434"
|
||||
:stream t
|
||||
:models '(deepseek-r1 deepseek-r1-fullctx qwen3:30b qwen3:4b llama3.1 qwen2.5-coder mistral-nemo gpt-oss)))
|
||||
|
||||
;; Define custom tools
|
||||
(gptel-make-tool
|
||||
:name "run_shell_command"
|
||||
:description "Execute shell commands and return output. Use this to run system commands, check file contents, or perform system operations."
|
||||
:function (lambda (command)
|
||||
(condition-case err
|
||||
(shell-command-to-string command)
|
||||
(error (format "Error running command: %s" (error-message-string err)))))
|
||||
:args (list '(:name "command" :type "string" :description "Shell command to execute")))
|
||||
|
||||
(gptel-make-tool
|
||||
:name "read_file"
|
||||
:description "Read the contents of a file and return as text"
|
||||
:function (lambda (filepath)
|
||||
(condition-case err
|
||||
(with-temp-buffer
|
||||
(insert-file-contents (expand-file-name filepath))
|
||||
(buffer-string))
|
||||
(error (format "Error reading file %s: %s" filepath (error-message-string err)))))
|
||||
:args (list '(:name "filepath" :type "string" :description "Path to the file to read")))
|
||||
|
||||
(gptel-make-tool
|
||||
:name "list_directory"
|
||||
:description "List contents of a directory"
|
||||
:function (lambda (dirpath)
|
||||
(condition-case err
|
||||
(mapconcat 'identity
|
||||
(directory-files (expand-file-name dirpath) nil "^[^.]")
|
||||
"\n")
|
||||
(error (format "Error listing directory %s: %s" dirpath (error-message-string err)))))
|
||||
:args (list '(:name "dirpath" :type "string" :description "Directory path to list"))))
|
||||
|
||||
(use-package! claude-code-ide
|
||||
:commands (claude-code-ide-menu claude-code-ide-open-here)
|
||||
:init
|
||||
(map! :leader
|
||||
(:prefix ("o" . "open")
|
||||
:desc "Claude Code IDE" "c" #'claude-code-ide-menu))
|
||||
:config
|
||||
(claude-code-ide-emacs-tools-setup)
|
||||
(setq claude-code-ide-cli-path "claude"
|
||||
claude-code-ide-cli-extra-flags "--dangerously-skip-permissions"
|
||||
claude-code-ide-focus-claude-after-ediff t
|
||||
claude-code-ide-focus-on-open t
|
||||
claude-code-ide-show-claude-window-in-ediff t
|
||||
claude-code-ide-switch-tab-on-ediff t
|
||||
claude-code-ide-use-ide-diff t
|
||||
claude-code-ide-use-side-window t
|
||||
claude-code-ide-window-height 20
|
||||
claude-code-ide-window-side 'right
|
||||
claude-code-ide-window-width 90))
|
||||
|
||||
(use-package! beads
|
||||
:commands (beads)
|
||||
:init
|
||||
(map! :leader
|
||||
(:prefix ("o" . "open")
|
||||
(:prefix ("B" . "beads")
|
||||
:desc "List issues" "B" (cmd! (require 'beads) (beads-list))
|
||||
:desc "Project issues" "p" (cmd! (require 'beads) (beads-project-list))
|
||||
:desc "Activity feed" "a" (cmd! (require 'beads) (beads-activity))
|
||||
:desc "Stale issues" "s" (cmd! (require 'beads) (beads-stale))
|
||||
:desc "Orphaned issues" "o" (cmd! (require 'beads) (beads-orphans))
|
||||
:desc "Find duplicates" "d" (cmd! (require 'beads) (beads-duplicates))
|
||||
:desc "Lint issues" "l" (cmd! (require 'beads) (beads-lint))))))
|
||||
|
||||
(after! gptel
|
||||
(require 'gptel-tool-library)
|
||||
(setq gptel-tool-library-use-maybe-safe t
|
||||
gptel-tool-library-use-unsafe t)
|
||||
(dolist (module '("bbdb" "buffer" "elisp" "emacs" "gnus" "os" "search-and-replace" "url"))
|
||||
(gptel-tool-library-load-module module)))
|
||||
|
||||
;; mu4e email configuration
|
||||
;; Add NixOS mu4e to load-path (installed via mu.mu4e package)
|
||||
(when-let ((mu-path (executable-find "mu")))
|
||||
(add-to-list 'load-path
|
||||
(expand-file-name "../share/emacs/site-lisp/mu4e"
|
||||
(file-name-directory mu-path))))
|
||||
|
||||
(after! mu4e
|
||||
;; User identity
|
||||
(setq user-mail-address "john@ogle.fyi"
|
||||
user-full-name "John Ogle")
|
||||
|
||||
;; Maildir location (no account prefix - single account)
|
||||
(setq mu4e-maildir "~/Mail"
|
||||
mu4e-attachment-dir "~/Downloads")
|
||||
|
||||
;; Folder config (matches ~/Mail/INBOX, ~/Mail/Sent, etc.)
|
||||
(setq mu4e-sent-folder "/Sent"
|
||||
mu4e-drafts-folder "/Drafts"
|
||||
mu4e-trash-folder "/Trash"
|
||||
mu4e-refile-folder "/Archive")
|
||||
|
||||
;; Shortcuts for common folders
|
||||
(setq mu4e-maildir-shortcuts
|
||||
'((:maildir "/INBOX" :key ?i)
|
||||
(:maildir "/Archive" :key ?a)
|
||||
(:maildir "/Sent" :key ?s)
|
||||
(:maildir "/Trash" :key ?t)))
|
||||
|
||||
;; Behavior settings
|
||||
(setq mu4e-get-mail-command "mbsync -a"
|
||||
mu4e-update-interval 300 ; 5 minutes (matches systemd timer)
|
||||
mu4e-change-filenames-when-moving t ; required for mbsync
|
||||
mu4e-headers-date-format "%Y-%m-%d"
|
||||
mu4e-headers-time-format "%H:%M")
|
||||
|
||||
;; Sending mail via msmtp
|
||||
;; NOTE: message-sendmail-f-is-evil and --read-envelope-from are required
|
||||
;; to prevent msmtp from stripping the email body when processing headers.
|
||||
;; Without these, multipart messages (especially from org-msg) may arrive
|
||||
;; with empty bodies.
|
||||
(setq sendmail-program (executable-find "msmtp")
|
||||
send-mail-function #'message-send-mail-with-sendmail
|
||||
message-send-mail-function #'message-send-mail-with-sendmail
|
||||
message-sendmail-f-is-evil t
|
||||
message-sendmail-extra-arguments '("--read-envelope-from")
|
||||
message-sendmail-envelope-from 'header))
|
||||
|
||||
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
||||
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
||||
;;
|
||||
;; (after! PACKAGE
|
||||
;; (setq x y))
|
||||
;;
|
||||
;; The exceptions to this rule:
|
||||
;;
|
||||
;; - Setting file/directory variables (like `org-directory')
|
||||
;; - Setting variables which explicitly tell you to set them before their
|
||||
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
|
||||
;; - Setting doom variables (which start with 'doom-' or '+').
|
||||
;;
|
||||
;; Here are some additional functions/macros that will help you configure Doom.
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
;; - `use-package!' for configuring packages
|
||||
;; - `after!' for running code after a package has loaded
|
||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
||||
;; this file. Emacs searches the `load-path' when you load packages with
|
||||
;; `require' or `use-package'.
|
||||
;; - `map!' for binding new keys
|
||||
;;
|
||||
;; To get information about any of these functions/macros, move the cursor over
|
||||
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
||||
;; This will open documentation for it, including demos of how they are used.
|
||||
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
||||
;; etc).
|
||||
;;
|
||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
@@ -33,7 +33,7 @@
|
||||
doom ; what makes DOOM look the way it does
|
||||
doom-dashboard ; a nifty splash screen for Emacs
|
||||
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
|
||||
(emoji +unicode) ; 🙂
|
||||
;;(emoji +unicode) ; 🙂
|
||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
||||
;;indent-guides ; highlighted indent columns
|
||||
;;ligatures ; ligatures and symbols to make your code pretty again
|
||||
@@ -45,7 +45,7 @@
|
||||
(popup +defaults) ; tame sudden yet inevitable temporary windows
|
||||
;;tabs ; a tab bar for Emacs
|
||||
;;treemacs ; a project drawer, like neotree but cooler
|
||||
;;unicode ; extended unicode support for various languages
|
||||
unicode ; extended unicode support for various languages
|
||||
(vc-gutter +pretty) ; vcs diff in the fringe
|
||||
vi-tilde-fringe ; fringe tildes to mark beyond EOB
|
||||
;;window-select ; visually switch windows
|
||||
@@ -59,7 +59,7 @@
|
||||
;;(format +onsave) ; automated prettiness
|
||||
;;god ; run Emacs commands without modifier keys
|
||||
;;lispy ; vim for lisp, for people who don't like vim
|
||||
;;multiple-cursors ; editing in many places at once
|
||||
multiple-cursors ; editing in many places at once
|
||||
;;objed ; text object editing for the innocent
|
||||
;;parinfer ; turn lisp into python, sort of
|
||||
;;rotate-text ; cycle region at point between text candidates
|
||||
@@ -77,7 +77,7 @@
|
||||
;;eshell ; the elisp shell that works everywhere
|
||||
;;shell ; simple shell REPL for Emacs
|
||||
;;term ; basic terminal emulator for Emacs
|
||||
;;vterm ; the best terminal emulation in Emacs
|
||||
vterm ; the best terminal emulation in Emacs
|
||||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
@@ -94,6 +94,7 @@
|
||||
;;editorconfig ; let someone else argue about tabs vs spaces
|
||||
;;ein ; tame Jupyter notebooks with emacs
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
llm ; When I said you needed friends, I didn't mean...
|
||||
lookup ; navigate your code and its documentation
|
||||
lsp ; M-x vscode
|
||||
magit ; a git porcelain for Emacs
|
||||
@@ -108,7 +109,7 @@
|
||||
|
||||
:os
|
||||
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
|
||||
;;tty ; improve the terminal Emacs experience
|
||||
tty ; improve the terminal Emacs experience
|
||||
|
||||
:lang
|
||||
;;agda ; types of types of types of types...
|
||||
@@ -149,7 +150,7 @@
|
||||
;;lua ; one-based indices? one-based indices
|
||||
markdown ; writing docs for people to ignore
|
||||
;;nim ; python + lisp at the speed of c
|
||||
(nix +tree-sitter +lsp) ; I hereby declare "nix geht mehr!"
|
||||
(nix +tree-sitter) ; I hereby declare "nix geht mehr!"
|
||||
;;ocaml ; an objective camel
|
||||
(org +roam2) ; organize your plain life in plain text
|
||||
;;php ; perl's insecure younger brother
|
||||
@@ -175,7 +176,7 @@
|
||||
;;zig ; C, but simpler
|
||||
|
||||
:email
|
||||
;;(mu4e +org +gmail)
|
||||
(mu4e +org)
|
||||
;;notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
@@ -49,4 +49,23 @@
|
||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
||||
;; (unpin! t)
|
||||
|
||||
;; (package! org-caldav)
|
||||
(package! org-caldav)
|
||||
|
||||
;; Note: Packages with custom recipes must be pinned for nix-doom-emacs-unstraightened
|
||||
;; to build deterministically. Update pins when upgrading packages.
|
||||
|
||||
(package! gptel :recipe (:nonrecursive t))
|
||||
|
||||
(package! claude-code-ide
|
||||
:recipe (:host github :repo "manzaltu/claude-code-ide.el")
|
||||
:pin "760240d7f03ff16f90ede9d4f4243cd94f3fed73")
|
||||
|
||||
(package! gptel-tool-library
|
||||
:recipe (:host github :repo "aard-fi/gptel-tool-library"
|
||||
:files ("*.el"))
|
||||
:pin "baffc3b0d74a2b7cbda0d5cd6dd7726d6ccaca83")
|
||||
|
||||
(package! beads
|
||||
:recipe (:type git :repo "https://codeberg.org/ctietze/beads.el.git"
|
||||
:files ("lisp/*.el"))
|
||||
:pin "f40a6461d3c0fa0969311bbb6a1e30d1bba86c88")
|
||||
128
home/roles/email/default.nix
Normal file
@@ -0,0 +1,128 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.email;
|
||||
isLinux = pkgs.stdenv.isLinux;
|
||||
in
|
||||
{
|
||||
options.home.roles.email = {
|
||||
enable = mkEnableOption "Enable email with mu4e, mbsync, and msmtp";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
isync # provides mbsync for IMAP sync
|
||||
msmtp # for SMTP sending
|
||||
mu # email indexer for mu4e
|
||||
mu.mu4e # mu4e elisp files for Emacs
|
||||
openssl # for certificate management
|
||||
];
|
||||
|
||||
# Ensure Mail directory exists
|
||||
home.file."Mail/.keep".text = "";
|
||||
|
||||
# mbsync configuration
|
||||
home.file.".mbsyncrc".text = ''
|
||||
# IMAP Account Configuration
|
||||
IMAPAccount proton
|
||||
Host proton.johnogle.info
|
||||
Port 143
|
||||
User john@ogle.fyi
|
||||
PassCmd "${pkgs.rbw}/bin/rbw get proton.johnogle.info"
|
||||
TLSType STARTTLS
|
||||
AuthMechs PLAIN
|
||||
|
||||
# Remote Storage
|
||||
IMAPStore proton-remote
|
||||
Account proton
|
||||
|
||||
# Local Storage
|
||||
MaildirStore proton-local
|
||||
Path ~/Mail/
|
||||
Inbox ~/Mail/INBOX
|
||||
SubFolders Verbatim
|
||||
|
||||
# Channel Configuration - Main (excludes Sent)
|
||||
Channel proton-main
|
||||
Far :proton-remote:
|
||||
Near :proton-local:
|
||||
Patterns * !Sent
|
||||
Create Both
|
||||
Expunge Both
|
||||
SyncState *
|
||||
|
||||
# Channel Configuration - Sent (pull only)
|
||||
Channel proton-sent
|
||||
Far :proton-remote:Sent
|
||||
Near :proton-local:Sent
|
||||
Create Near
|
||||
Expunge Near
|
||||
Sync Pull
|
||||
SyncState *
|
||||
|
||||
# Group both channels
|
||||
Group proton
|
||||
Channel proton-main
|
||||
Channel proton-sent
|
||||
'';
|
||||
|
||||
# msmtp configuration
|
||||
home.file.".msmtprc".text = ''
|
||||
# Default settings
|
||||
defaults
|
||||
auth plain
|
||||
tls on
|
||||
tls_starttls on
|
||||
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
||||
logfile ${config.home.homeDirectory}/.msmtp.log
|
||||
|
||||
# Proton mail account
|
||||
account proton
|
||||
host proton.johnogle.info
|
||||
port 25
|
||||
from john@ogle.fyi
|
||||
user john@ogle.fyi
|
||||
passwordeval rbw get proton.johnogle.info
|
||||
|
||||
# Set default account
|
||||
account default : proton
|
||||
'';
|
||||
|
||||
# Linux-only: Systemd service for mail sync (Darwin uses launchd instead)
|
||||
systemd.user.services = mkIf isLinux {
|
||||
mbsync = {
|
||||
Unit = {
|
||||
Description = "Mailbox synchronization service";
|
||||
After = [ "network-online.target" ];
|
||||
Wants = [ "network-online.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.bash}/bin/bash -c 'mkdir -p ~/Mail && ${pkgs.isync}/bin/mbsync -a && (${pkgs.mu}/bin/mu info >/dev/null 2>&1 || ${pkgs.mu}/bin/mu init --maildir ~/Mail --personal-address=john@ogle.fyi) && ${pkgs.mu}/bin/mu index'";
|
||||
Environment = "PATH=${pkgs.rbw}/bin:${pkgs.coreutils}/bin";
|
||||
StandardOutput = "journal";
|
||||
StandardError = "journal";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Linux-only: Systemd timer for automatic sync
|
||||
systemd.user.timers = mkIf isLinux {
|
||||
mbsync = {
|
||||
Unit = {
|
||||
Description = "Mailbox synchronization timer";
|
||||
};
|
||||
Timer = {
|
||||
OnBootSec = "2min";
|
||||
OnUnitActiveSec = "5min";
|
||||
Unit = "mbsync.service";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
18
home/roles/gaming/default.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.gaming;
|
||||
in
|
||||
{
|
||||
options.home.roles.gaming = {
|
||||
enable = mkEnableOption "Enable gaming applications and tools";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
custom.mcrcon-rbw
|
||||
];
|
||||
};
|
||||
}
|
||||
496
home/roles/i3+sway/default.nix
Normal file
@@ -0,0 +1,496 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.i3_sway;
|
||||
wallpaperConfig = import ../../wallpapers;
|
||||
currentWallpaper = builtins.elemAt wallpaperConfig.wallpapers wallpaperConfig.currentIndex;
|
||||
|
||||
shared_config = recursiveUpdate rec {
|
||||
modifier = "Mod4";
|
||||
terminal = "ghostty";
|
||||
defaultWorkspace = "workspace number 1";
|
||||
|
||||
keybindings = {
|
||||
"${shared_config.modifier}+Return" = "exec ${terminal}";
|
||||
"${shared_config.modifier}+Shift+Return" = "exec ${cfg.browser}";
|
||||
"${shared_config.modifier}+Shift+q" = "kill";
|
||||
|
||||
"${shared_config.modifier}+a" = "focus parent";
|
||||
"${shared_config.modifier}+Shift+a" = "focus child";
|
||||
|
||||
"${shared_config.modifier}+h" = "focus left";
|
||||
"${shared_config.modifier}+j" = "focus down";
|
||||
"${shared_config.modifier}+k" = "focus up";
|
||||
"${shared_config.modifier}+l" = "focus right";
|
||||
|
||||
"${shared_config.modifier}+Shift+h" = "move left";
|
||||
"${shared_config.modifier}+Shift+j" = "move down";
|
||||
"${shared_config.modifier}+Shift+k" = "move up";
|
||||
"${shared_config.modifier}+Shift+l" = "move right";
|
||||
|
||||
"${shared_config.modifier}+Left" = "focus left";
|
||||
"${shared_config.modifier}+Down" = "focus down";
|
||||
"${shared_config.modifier}+Up" = "focus up";
|
||||
"${shared_config.modifier}+Right" = "focus right";
|
||||
|
||||
"${shared_config.modifier}+Shift+Left" = "move left";
|
||||
"${shared_config.modifier}+Shift+Down" = "move down";
|
||||
"${shared_config.modifier}+Shift+Up" = "move up";
|
||||
"${shared_config.modifier}+Shift+Right" = "move right";
|
||||
|
||||
#"${shared_config.modifier}+h" = "split h";
|
||||
"${shared_config.modifier}+v" = "split v";
|
||||
"${shared_config.modifier}+Shift+f" = "fullscreen toggle";
|
||||
|
||||
"${shared_config.modifier}+s" = "layout stacking";
|
||||
"${shared_config.modifier}+w" = "layout tabbed";
|
||||
"${shared_config.modifier}+e" = "layout toggle split";
|
||||
|
||||
"${shared_config.modifier}+Shift+space" = "floating toggle";
|
||||
"${shared_config.modifier}+space" = "focus mode_toggle";
|
||||
|
||||
"${shared_config.modifier}+Shift+minus" = "move scratchpad";
|
||||
"${shared_config.modifier}+minus" = "scratchpad show";
|
||||
|
||||
"${shared_config.modifier}+1" = "workspace number 1";
|
||||
"${shared_config.modifier}+2" = "workspace number 2";
|
||||
"${shared_config.modifier}+3" = "workspace number 3";
|
||||
"${shared_config.modifier}+4" = "workspace number 4";
|
||||
"${shared_config.modifier}+5" = "workspace number 5";
|
||||
"${shared_config.modifier}+6" = "workspace number 6";
|
||||
"${shared_config.modifier}+7" = "workspace number 7";
|
||||
"${shared_config.modifier}+8" = "workspace number 8";
|
||||
"${shared_config.modifier}+9" = "workspace number 9";
|
||||
"${shared_config.modifier}+0" = "workspace number 10";
|
||||
|
||||
"${shared_config.modifier}+Shift+1" =
|
||||
"move container to workspace number 1";
|
||||
"${shared_config.modifier}+Shift+2" =
|
||||
"move container to workspace number 2";
|
||||
"${shared_config.modifier}+Shift+3" =
|
||||
"move container to workspace number 3";
|
||||
"${shared_config.modifier}+Shift+4" =
|
||||
"move container to workspace number 4";
|
||||
"${shared_config.modifier}+Shift+5" =
|
||||
"move container to workspace number 5";
|
||||
"${shared_config.modifier}+Shift+6" =
|
||||
"move container to workspace number 6";
|
||||
"${shared_config.modifier}+Shift+7" =
|
||||
"move container to workspace number 7";
|
||||
"${shared_config.modifier}+Shift+8" =
|
||||
"move container to workspace number 8";
|
||||
"${shared_config.modifier}+Shift+9" =
|
||||
"move container to workspace number 9";
|
||||
"${shared_config.modifier}+Shift+0" =
|
||||
"move container to workspace number 10";
|
||||
|
||||
"${shared_config.modifier}+Shift+c" = "reload";
|
||||
"${shared_config.modifier}+Shift+r" = "restart";
|
||||
|
||||
"${shared_config.modifier}+r" = "mode resize";
|
||||
|
||||
"XF86MonBrightnessUp" = "exec ddcutil setvcp 10 + 5";
|
||||
"XF86MonBrightnessDown" = "exec ddcutil setvcp 10 - 5";
|
||||
};
|
||||
} cfg.extraSharedConfig;
|
||||
in {
|
||||
options.home.roles.i3_sway = {
|
||||
enable = mkEnableOption "i3 and Sway tiling window managers with waybar and rofi";
|
||||
|
||||
browser = mkOption {
|
||||
type = types.str;
|
||||
default = "firefox --new-window";
|
||||
description = "Browser to use for new window keybinding";
|
||||
};
|
||||
|
||||
extraSharedConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = "Extra configuration shared between i3 and sway";
|
||||
};
|
||||
|
||||
extraI3Config = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = "Extra i3-specific configuration";
|
||||
};
|
||||
|
||||
extraSwayConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = "Extra sway-specific configuration";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# i3blocks configuration file
|
||||
home.file.".config/i3blocks/config".text = ''
|
||||
# i3blocks config - replicating waybar setup
|
||||
separator_block_width=15
|
||||
markup=pango
|
||||
|
||||
[disk]
|
||||
command=df -h / | awk 'NR==2 {print "💾 " $5}'
|
||||
interval=30
|
||||
separator=true
|
||||
|
||||
[cpu]
|
||||
command=top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print "🧠 " int(100 - $1) "%"}'
|
||||
interval=2
|
||||
separator=true
|
||||
|
||||
[memory]
|
||||
command=free | awk 'NR==2 {printf "🐏 %.0f%%\n", $3*100/$2}'
|
||||
interval=5
|
||||
separator=true
|
||||
|
||||
[pulseaudio]
|
||||
command=${pkgs.writeShellScript "i3blocks-pulseaudio" ''
|
||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '\d+%' | head -1)
|
||||
muted=$(pactl get-sink-mute @DEFAULT_SINK@ | grep -o 'yes')
|
||||
if [ "$muted" = "yes" ]; then
|
||||
echo "🔇"
|
||||
else
|
||||
vol_num=''${volume%\%}
|
||||
if [ $vol_num -le 33 ]; then
|
||||
echo "🔈 $volume"
|
||||
elif [ $vol_num -le 66 ]; then
|
||||
echo "🔉 $volume"
|
||||
else
|
||||
echo "🔊 $volume"
|
||||
fi
|
||||
fi
|
||||
''}
|
||||
interval=1
|
||||
signal=10
|
||||
separator=true
|
||||
|
||||
[backlight]
|
||||
command=${pkgs.writeShellScript "i3blocks-backlight" ''
|
||||
if command -v ddcutil &>/dev/null; then
|
||||
# Handle mouse scroll events
|
||||
case $BLOCK_BUTTON in
|
||||
4) ddcutil setvcp 10 + 5 ;; # Scroll up - increase brightness
|
||||
5) ddcutil setvcp 10 - 5 ;; # Scroll down - decrease brightness
|
||||
esac
|
||||
|
||||
# Display current brightness
|
||||
brightness=$(ddcutil getvcp 10 2>/dev/null | grep -oP 'current value =\s*\K\d+')
|
||||
if [ -n "$brightness" ]; then
|
||||
echo "☀️ $brightness%"
|
||||
fi
|
||||
fi
|
||||
''}
|
||||
interval=5
|
||||
separator=true
|
||||
|
||||
[network]
|
||||
command=${pkgs.writeShellScript "i3blocks-network" ''
|
||||
if iwgetid -r &>/dev/null; then
|
||||
ssid=$(iwgetid -r)
|
||||
signal=$(grep "^\s*w" /proc/net/wireless | awk '{print int($3 * 100 / 70)}')
|
||||
echo "📶 $ssid ($signal%)"
|
||||
else
|
||||
ip=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' | head -1)
|
||||
if [ -n "$ip" ]; then
|
||||
echo "🔌 $ip"
|
||||
else
|
||||
echo "❌"
|
||||
fi
|
||||
fi
|
||||
''}
|
||||
interval=5
|
||||
separator=true
|
||||
|
||||
[battery]
|
||||
command=${pkgs.writeShellScript "i3blocks-battery" ''
|
||||
if [ -d /sys/class/power_supply/BAT0 ]; then
|
||||
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
if [ "$status" = "Charging" ]; then
|
||||
echo "⚡ $capacity%"
|
||||
else
|
||||
echo "🔋 $capacity%"
|
||||
fi
|
||||
fi
|
||||
''}
|
||||
interval=10
|
||||
separator=true
|
||||
|
||||
[time]
|
||||
command=date '+%Y-%m-%d %H:%M'
|
||||
interval=1
|
||||
separator=false
|
||||
'';
|
||||
|
||||
xsession.windowManager.i3 = let
|
||||
base_i3_config = recursiveUpdate shared_config {
|
||||
bars = [{
|
||||
position = "bottom";
|
||||
statusCommand = "${pkgs.i3blocks}/bin/i3blocks";
|
||||
trayOutput = "primary"; # Enable system tray on primary output
|
||||
fonts = {
|
||||
names = [ "Fira Code" "monospace" ];
|
||||
size = 11.0;
|
||||
};
|
||||
colors = {
|
||||
background = "#000000";
|
||||
statusline = "#ffffff";
|
||||
separator = "#666666";
|
||||
|
||||
# Workspace button colors (matching waybar)
|
||||
focusedWorkspace = {
|
||||
border = "#285577";
|
||||
background = "#285577";
|
||||
text = "#ffffff";
|
||||
};
|
||||
activeWorkspace = {
|
||||
border = "#5f676a";
|
||||
background = "#5f676a";
|
||||
text = "#ffffff";
|
||||
};
|
||||
inactiveWorkspace = {
|
||||
border = "#222222";
|
||||
background = "#222222";
|
||||
text = "#888888";
|
||||
};
|
||||
urgentWorkspace = {
|
||||
border = "#900000";
|
||||
background = "#900000";
|
||||
text = "#ffffff";
|
||||
};
|
||||
};
|
||||
}];
|
||||
keybindings = shared_config.keybindings // {
|
||||
"${shared_config.modifier}+d" = "exec rofi -show drun";
|
||||
"${shared_config.modifier}+Shift+e" =
|
||||
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
|
||||
};
|
||||
startup = [
|
||||
# GNOME polkit authentication agent
|
||||
{
|
||||
command = "/run/current-system/sw/libexec/polkit-gnome-authentication-agent-1";
|
||||
always = false;
|
||||
notification = false;
|
||||
}
|
||||
# Picom compositor for smooth rendering and no tearing (important for Nvidia)
|
||||
{
|
||||
command = "picom --backend glx -b";
|
||||
always = false;
|
||||
notification = false;
|
||||
}
|
||||
# NetworkManager system tray applet
|
||||
{
|
||||
command = "nm-applet";
|
||||
always = false;
|
||||
notification = false;
|
||||
}
|
||||
# Set wallpaper with feh
|
||||
{
|
||||
command = "feh ${currentWallpaper.feh} ${currentWallpaper.file}";
|
||||
always = false;
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
config = recursiveUpdate base_i3_config cfg.extraI3Config;
|
||||
};
|
||||
|
||||
wayland.windowManager.sway = let
|
||||
base_sway_config = recursiveUpdate shared_config {
|
||||
bars = []; # Disable default bar, use waybar instead
|
||||
keybindings = shared_config.keybindings // {
|
||||
"${shared_config.modifier}+d" = "exec wofi --show drun";
|
||||
"${shared_config.modifier}+Shift+e" =
|
||||
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
||||
};
|
||||
input = {
|
||||
"type:keyboard" = {
|
||||
xkb_options = "caps:escape";
|
||||
};
|
||||
"type:touchpad" = {
|
||||
tap = "enabled";
|
||||
tap_button_map = "lrm";
|
||||
drag = "enabled";
|
||||
natural_scroll = "disabled";
|
||||
dwt = "enabled";
|
||||
};
|
||||
};
|
||||
output = {
|
||||
"*" = {
|
||||
bg = "${currentWallpaper.file} ${currentWallpaper.sway}";
|
||||
};
|
||||
};
|
||||
startup = [
|
||||
# Launch waybar status bar
|
||||
{
|
||||
command = "waybar";
|
||||
always = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
extraOptions = [ "--unsupported-gpu" ];
|
||||
config = recursiveUpdate base_sway_config cfg.extraSwayConfig;
|
||||
};
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
systemd.enable = false; # Don't auto-start via systemd - only launch in sway
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "bottom";
|
||||
height = 30;
|
||||
spacing = 4;
|
||||
|
||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||
modules-center = [ ];
|
||||
modules-right = [ "disk" "cpu" "memory" "pulseaudio" "custom/backlight-ddc" "backlight" "network" "battery" "tray" "clock" ];
|
||||
|
||||
"sway/workspaces" = {
|
||||
disable-scroll = true;
|
||||
all-outputs = true;
|
||||
};
|
||||
|
||||
"clock" = {
|
||||
format = "{:%Y-%m-%d %H:%M}";
|
||||
tooltip-format = "<tt><small>{calendar}</small></tt>";
|
||||
calendar = {
|
||||
mode = "year";
|
||||
mode-mon-col = 3;
|
||||
weeks-pos = "right";
|
||||
on-scroll = 1;
|
||||
format = {
|
||||
months = "<span color='#ffead3'><b>{}</b></span>";
|
||||
days = "<span color='#ecc6d9'><b>{}</b></span>";
|
||||
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
|
||||
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
|
||||
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"disk" = {
|
||||
interval = 30;
|
||||
format = "💾 {percentage_used}%";
|
||||
path = "/";
|
||||
tooltip-format = "Used: {used} / {total} ({percentage_used}%)\nFree: {free} ({percentage_free}%)";
|
||||
};
|
||||
|
||||
"cpu" = {
|
||||
format = "🧠 {usage}%";
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"memory" = {
|
||||
format = "🐏 {percentage}%";
|
||||
tooltip-format = "RAM: {used:0.1f}G / {total:0.1f}G";
|
||||
};
|
||||
|
||||
"pulseaudio" = {
|
||||
format = "{icon} {volume}%";
|
||||
format-muted = "🔇";
|
||||
format-icons = {
|
||||
headphone = "🎧";
|
||||
default = [ "🔈" "🔉" "🔊" ];
|
||||
};
|
||||
on-click = "pavucontrol";
|
||||
};
|
||||
|
||||
"backlight" = {
|
||||
format = "☀️ {percent}%";
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"custom/backlight-ddc" = {
|
||||
exec = pkgs.writeShellScript "waybar-backlight-ddc" ''
|
||||
if command -v ddcutil &>/dev/null; then
|
||||
# Display current brightness
|
||||
brightness=$(ddcutil getvcp 10 --brief 2>/dev/null | awk '{print $4}')
|
||||
if [ -n "$brightness" ]; then
|
||||
echo "☀️ $brightness%"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
interval = 5;
|
||||
format = "{}";
|
||||
on-scroll-up = "ddcutil setvcp 10 + 5 2>/dev/null &";
|
||||
on-scroll-down = "ddcutil setvcp 10 - 5 2>/dev/null &";
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"network" = {
|
||||
format-wifi = "📶 {essid} ({signalStrength}%)";
|
||||
format-ethernet = "🔌 {ipaddr}";
|
||||
format-disconnected = "❌";
|
||||
tooltip-format = "{ifname}: {ipaddr}/{cidr}";
|
||||
};
|
||||
|
||||
"battery" = {
|
||||
states = {
|
||||
warning = 30;
|
||||
critical = 15;
|
||||
};
|
||||
format = "{icon} {capacity}%";
|
||||
format-charging = "⚡ {capacity}%";
|
||||
format-icons = [ "🪫" "🔋" "🔋" "🔋" "🔋" ];
|
||||
};
|
||||
|
||||
"tray" = {
|
||||
spacing = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
style = ''
|
||||
* {
|
||||
padding: 0 4px;
|
||||
font-family: "Fira Code", monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 8px;
|
||||
background-color: #333333;
|
||||
color: #ffffff;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
background-color: #285577;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#workspaces button.visible {
|
||||
background-color: #5f676a;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: #900000;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
theme = "solarized";
|
||||
extraConfig = {
|
||||
modi = "drun,run,window";
|
||||
show-icons = true;
|
||||
drun-display-format = "{name}";
|
||||
disable-history = false;
|
||||
hide-scrollbar = true;
|
||||
display-drun = " Apps";
|
||||
display-run = " Run";
|
||||
display-window = " Windows";
|
||||
sidebar-mode = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
22
home/roles/kdeconnect/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.kdeconnect;
|
||||
isLinux = pkgs.stdenv.isLinux;
|
||||
in
|
||||
{
|
||||
options.home.roles.kdeconnect = {
|
||||
enable = mkEnableOption "Enable KDE Connect for device integration";
|
||||
};
|
||||
|
||||
# KDE Connect services are Linux-only (requires D-Bus and systemd)
|
||||
config = mkIf (cfg.enable && isLinux) {
|
||||
services.kdeconnect = {
|
||||
enable = true;
|
||||
indicator = true;
|
||||
package = pkgs.kdePackages.kdeconnect-kde;
|
||||
};
|
||||
};
|
||||
}
|
||||
243
home/roles/kubectl/default.nix
Normal file
@@ -0,0 +1,243 @@
|
||||
{ config, lib, pkgs, globalInputs, system, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.kubectl;
|
||||
in
|
||||
{
|
||||
options.home.roles.kubectl = {
|
||||
enable = mkEnableOption "management tools for the homelab k3s oglenet cluster with secure Bitwarden integration";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
];
|
||||
|
||||
programs.k9s.enable = true;
|
||||
|
||||
programs.bash.initExtra = mkAfter ''
|
||||
# Kubectl secure session management
|
||||
export KUBECTL_SESSION_DIR="/dev/shm/kubectl-$$"
|
||||
|
||||
kube-select() {
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: kube-select <context-name>"
|
||||
echo "Available contexts: $(kube-list)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local context="$1"
|
||||
|
||||
# Clean up any existing session first
|
||||
kube-clear 2>/dev/null
|
||||
|
||||
# Create new session directory
|
||||
mkdir -p "$KUBECTL_SESSION_DIR"
|
||||
chmod 700 "$KUBECTL_SESSION_DIR"
|
||||
|
||||
# Set cleanup trap for this shell session
|
||||
trap "rm -rf '$KUBECTL_SESSION_DIR' 2>/dev/null" EXIT
|
||||
|
||||
# Set KUBECONFIG for this session
|
||||
export KUBECONFIG="$KUBECTL_SESSION_DIR/config"
|
||||
|
||||
# Load config from Bitwarden secure notes
|
||||
if ! rbw get "kubectl-$context" > "$KUBECONFIG" 2>/dev/null; then
|
||||
echo "Error: Could not retrieve kubectl-$context from Bitwarden"
|
||||
echo "Make sure the entry exists with name: kubectl-$context"
|
||||
kube-clear
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Verify the kubeconfig is valid
|
||||
if ! kubectl config view >/dev/null 2>&1; then
|
||||
echo "Error: Invalid kubeconfig retrieved from Bitwarden"
|
||||
kube-clear
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "✓ Loaded kubectl context: $context (session: $$)"
|
||||
echo " Config location: $KUBECONFIG"
|
||||
}
|
||||
|
||||
kube-list() {
|
||||
echo "Available kubectl contexts in Bitwarden:"
|
||||
rbw search kubectl- 2>/dev/null | grep "^kubectl-" | sed 's/^kubectl-/ - /' || echo " (none found or rbw not accessible)"
|
||||
}
|
||||
|
||||
kube-clear() {
|
||||
if [[ -n "$KUBECTL_TIMEOUT_PID" ]]; then
|
||||
kill "$KUBECTL_TIMEOUT_PID" 2>/dev/null
|
||||
unset KUBECTL_TIMEOUT_PID
|
||||
fi
|
||||
|
||||
if [[ -d "$KUBECTL_SESSION_DIR" ]]; then
|
||||
rm -rf "$KUBECTL_SESSION_DIR"
|
||||
echo "Cleared kubectl session ($$)"
|
||||
fi
|
||||
|
||||
unset KUBECONFIG
|
||||
}
|
||||
|
||||
kube-status() {
|
||||
if [[ -f "$KUBECONFIG" ]]; then
|
||||
local current_context
|
||||
current_context=$(kubectl config current-context 2>/dev/null)
|
||||
if [[ -n "$current_context" ]]; then
|
||||
echo "Active kubectl context: $current_context"
|
||||
echo "Session: $$ | Config: $KUBECONFIG"
|
||||
|
||||
# Show cluster info
|
||||
local cluster_server
|
||||
cluster_server=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' 2>/dev/null)
|
||||
if [[ -n "$cluster_server" ]]; then
|
||||
echo "Cluster: $cluster_server"
|
||||
fi
|
||||
else
|
||||
echo "No active context in current session"
|
||||
fi
|
||||
else
|
||||
echo "No kubectl session active in this shell"
|
||||
echo "Use 'kube-select <context>' to start a session"
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to show available commands
|
||||
kube-help() {
|
||||
echo "Secure kubectl session management commands:"
|
||||
echo ""
|
||||
echo "Session management:"
|
||||
echo " kube-select <context> - Load kubeconfig from Bitwarden"
|
||||
echo " kube-status - Show current session status"
|
||||
echo " kube-clear - Clear current session"
|
||||
echo ""
|
||||
echo "Configuration management:"
|
||||
echo " kube-list - List available contexts in Bitwarden"
|
||||
echo ""
|
||||
echo "Help:"
|
||||
echo " kube-help - Show this help"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " kube-select prod # Loads from secure note"
|
||||
echo " kubectl get pods"
|
||||
echo " kube-clear"
|
||||
echo ""
|
||||
echo "Note: Kubeconfigs are stored as secure notes in Bitwarden"
|
||||
}
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkAfter ''
|
||||
# Kubectl secure session management (zsh)
|
||||
export KUBECTL_SESSION_DIR="/dev/shm/kubectl-$$"
|
||||
|
||||
kube-select() {
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: kube-select <context-name>"
|
||||
echo "Available contexts: $(kube-list)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local context="$1"
|
||||
|
||||
# Clean up any existing session first
|
||||
kube-clear 2>/dev/null
|
||||
|
||||
# Create new session directory
|
||||
mkdir -p "$KUBECTL_SESSION_DIR"
|
||||
chmod 700 "$KUBECTL_SESSION_DIR"
|
||||
|
||||
# Set cleanup trap for this shell session
|
||||
trap "rm -rf '$KUBECTL_SESSION_DIR' 2>/dev/null" EXIT
|
||||
|
||||
# Set KUBECONFIG for this session
|
||||
export KUBECONFIG="$KUBECTL_SESSION_DIR/config"
|
||||
|
||||
# Load config from Bitwarden secure notes
|
||||
if ! rbw get "kubectl-$context" > "$KUBECONFIG" 2>/dev/null; then
|
||||
echo "Error: Could not retrieve kubectl-$context from Bitwarden"
|
||||
echo "Make sure the entry exists with name: kubectl-$context"
|
||||
kube-clear
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Verify the kubeconfig is valid
|
||||
if ! kubectl config view >/dev/null 2>&1; then
|
||||
echo "Error: Invalid kubeconfig retrieved from Bitwarden"
|
||||
kube-clear
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "✓ Loaded kubectl context: $context (session: $$)"
|
||||
echo " Config location: $KUBECONFIG"
|
||||
}
|
||||
|
||||
kube-list() {
|
||||
echo "Available kubectl contexts in Bitwarden:"
|
||||
rbw search kubectl- 2>/dev/null | grep "^kubectl-" | sed 's/^kubectl-/ - /' || echo " (none found or rbw not accessible)"
|
||||
}
|
||||
|
||||
kube-clear() {
|
||||
if [[ -n "$KUBECTL_TIMEOUT_PID" ]]; then
|
||||
kill "$KUBECTL_TIMEOUT_PID" 2>/dev/null
|
||||
unset KUBECTL_TIMEOUT_PID
|
||||
fi
|
||||
|
||||
if [[ -d "$KUBECTL_SESSION_DIR" ]]; then
|
||||
rm -rf "$KUBECTL_SESSION_DIR"
|
||||
echo "Cleared kubectl session ($$)"
|
||||
fi
|
||||
|
||||
unset KUBECONFIG
|
||||
}
|
||||
|
||||
kube-status() {
|
||||
if [[ -f "$KUBECONFIG" ]]; then
|
||||
local current_context
|
||||
current_context=$(kubectl config current-context 2>/dev/null)
|
||||
if [[ -n "$current_context" ]]; then
|
||||
echo "Active kubectl context: $current_context"
|
||||
echo "Session: $$ | Config: $KUBECONFIG"
|
||||
|
||||
# Show cluster info
|
||||
local cluster_server
|
||||
cluster_server=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' 2>/dev/null)
|
||||
if [[ -n "$cluster_server" ]]; then
|
||||
echo "Cluster: $cluster_server"
|
||||
fi
|
||||
else
|
||||
echo "No active context in current session"
|
||||
fi
|
||||
else
|
||||
echo "No kubectl session active in this shell"
|
||||
echo "Use 'kube-select <context>' to start a session"
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to show available commands
|
||||
kube-help() {
|
||||
echo "Secure kubectl session management commands:"
|
||||
echo ""
|
||||
echo "Session management:"
|
||||
echo " kube-select <context> - Load kubeconfig from Bitwarden"
|
||||
echo " kube-status - Show current session status"
|
||||
echo " kube-clear - Clear current session"
|
||||
echo ""
|
||||
echo "Configuration management:"
|
||||
echo " kube-list - List available contexts in Bitwarden"
|
||||
echo ""
|
||||
echo "Help:"
|
||||
echo " kube-help - Show this help"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " kube-select prod # Loads from secure note"
|
||||
echo " kubectl get pods"
|
||||
echo " kube-clear"
|
||||
echo ""
|
||||
echo "Note: Kubeconfigs are stored as secure notes in Bitwarden"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
36
home/roles/launchers/default.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.launchers;
|
||||
|
||||
# Generate a wrapper script for a package
|
||||
makeLauncher = packageName: pkgs.writeShellScriptBin packageName ''
|
||||
exec env NIXPKGS_ALLOW_UNFREE=1 ${pkgs.nix}/bin/nix run --impure nixpkgs#${packageName} -- "$@"
|
||||
'';
|
||||
|
||||
# Generate all launcher scripts from the package list
|
||||
launcherPackages = map makeLauncher cfg.packages;
|
||||
in
|
||||
{
|
||||
options.home.roles.launchers = {
|
||||
enable = mkEnableOption "wrapper launchers for excluded packages";
|
||||
|
||||
packages = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = [ "steam" "libreoffice" "lutris" ];
|
||||
description = ''
|
||||
List of package names to create launcher wrappers for.
|
||||
Each wrapper will run: NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#<package>
|
||||
|
||||
This is useful for occasionally running packages without permanently installing them.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = launcherPackages;
|
||||
};
|
||||
}
|
||||
27
home/roles/media/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.media;
|
||||
in
|
||||
{
|
||||
options.home.roles.media = {
|
||||
enable = mkEnableOption "Enable media and multimedia applications";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
# Media players and streaming
|
||||
# Using delfin instead of jellyfin-media-player to avoid qtwebengine security issues
|
||||
# For full Jellyfin features, use web interface at http://jellyfin-server:8096
|
||||
delfin
|
||||
moonlight-qt
|
||||
vlc
|
||||
|
||||
# Spotify client
|
||||
# Using unstable version for better authentication support
|
||||
unstable.ncspot
|
||||
];
|
||||
};
|
||||
}
|
||||
22
home/roles/office/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.office;
|
||||
in
|
||||
{
|
||||
options.home.roles.office = {
|
||||
enable = mkEnableOption "Enable office applications and document processing tools";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
# Office suite
|
||||
libreoffice
|
||||
|
||||
# CAD/Design tools
|
||||
openscad-unstable
|
||||
];
|
||||
};
|
||||
}
|
||||
199
home/roles/plasma-manager-kodi/default.nix
Normal file
@@ -0,0 +1,199 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.plasma-manager-kodi;
|
||||
|
||||
# Define the volume control scripts as derivations
|
||||
volumeUpScript = pkgs.writeShellScript "avr-volume-up" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Configuration
|
||||
HA_URL="https://home-assistant.johnogle.info"
|
||||
ENTITY_ID="media_player.denon_avr_s970h_2"
|
||||
MAX_RETRIES=3
|
||||
|
||||
# Read token from KDE Wallet and strip whitespace
|
||||
TOKEN=$(${pkgs.kdePackages.kwallet}/bin/kwallet-query -r ha_avr_token kdewallet -f Passwords 2>/dev/null | tr -d '[:space:]')
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send -u critical "Volume Control Error" "Failed to retrieve Home Assistant token from KDE Wallet"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Send volume up command with retry logic
|
||||
for i in $(seq 1 $MAX_RETRIES); do
|
||||
RESPONSE=$(${pkgs.curl}/bin/curl -s -w "\n%{http_code}" -X POST \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"entity_id\": \"$ENTITY_ID\"}" \
|
||||
"$HA_URL/api/services/media_player/volume_up" 2>&1)
|
||||
|
||||
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||
|
||||
if [ "$HTTP_CODE" = "200" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Wait before retry (except on last attempt)
|
||||
if [ $i -lt $MAX_RETRIES ]; then
|
||||
sleep 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
# All retries failed
|
||||
${pkgs.libnotify}/bin/notify-send -u critical "Volume Control Error" "Failed to increase volume after $MAX_RETRIES attempts"
|
||||
exit 1
|
||||
'';
|
||||
|
||||
volumeDownScript = pkgs.writeShellScript "avr-volume-down" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Configuration
|
||||
HA_URL="https://home-assistant.johnogle.info"
|
||||
ENTITY_ID="media_player.denon_avr_s970h_2"
|
||||
MAX_RETRIES=3
|
||||
|
||||
# Read token from KDE Wallet and strip whitespace
|
||||
TOKEN=$(${pkgs.kdePackages.kwallet}/bin/kwallet-query -r ha_avr_token kdewallet -f Passwords 2>/dev/null | tr -d '[:space:]')
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send -u critical "Volume Control Error" "Failed to retrieve Home Assistant token from KDE Wallet"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Send volume down command with retry logic
|
||||
for i in $(seq 1 $MAX_RETRIES); do
|
||||
RESPONSE=$(${pkgs.curl}/bin/curl -s -w "\n%{http_code}" -X POST \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"entity_id\": \"$ENTITY_ID\"}" \
|
||||
"$HA_URL/api/services/media_player/volume_down" 2>&1)
|
||||
|
||||
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||
|
||||
if [ "$HTTP_CODE" = "200" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Wait before retry (except on last attempt)
|
||||
if [ $i -lt $MAX_RETRIES ]; then
|
||||
sleep 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
# All retries failed
|
||||
${pkgs.libnotify}/bin/notify-send -u critical "Volume Control Error" "Failed to decrease volume after $MAX_RETRIES attempts"
|
||||
exit 1
|
||||
'';
|
||||
|
||||
volumeMuteScript = pkgs.writeShellScript "avr-volume-mute" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Configuration
|
||||
HA_URL="https://home-assistant.johnogle.info"
|
||||
ENTITY_ID="media_player.denon_avr_s970h_2"
|
||||
MAX_RETRIES=3
|
||||
|
||||
# Read token from KDE Wallet and strip whitespace
|
||||
TOKEN=$(${pkgs.kdePackages.kwallet}/bin/kwallet-query -r ha_avr_token kdewallet -f Passwords 2>/dev/null | tr -d '[:space:]')
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send -u critical "Volume Control Error" "Failed to retrieve Home Assistant token from KDE Wallet"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get current mute state
|
||||
STATE_RESPONSE=$(${pkgs.curl}/bin/curl -s -H "Authorization: Bearer $TOKEN" \
|
||||
"$HA_URL/api/states/$ENTITY_ID")
|
||||
|
||||
CURRENT_MUTE=$(echo "$STATE_RESPONSE" | ${pkgs.jq}/bin/jq -r '.attributes.is_volume_muted // false')
|
||||
|
||||
# Toggle: if currently muted (true), unmute (false), and vice versa
|
||||
if [ "$CURRENT_MUTE" = "true" ]; then
|
||||
NEW_MUTE="false"
|
||||
NOTIFY_MSG="Unmuted"
|
||||
else
|
||||
NEW_MUTE="true"
|
||||
NOTIFY_MSG="Muted"
|
||||
fi
|
||||
|
||||
# Send mute toggle command with retry logic
|
||||
for i in $(seq 1 $MAX_RETRIES); do
|
||||
RESPONSE=$(${pkgs.curl}/bin/curl -s -w "\n%{http_code}" -X POST \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"entity_id\": \"$ENTITY_ID\", \"is_volume_muted\": $NEW_MUTE}" \
|
||||
"$HA_URL/api/services/media_player/volume_mute" 2>&1)
|
||||
|
||||
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||
|
||||
if [ "$HTTP_CODE" = "200" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Wait before retry (except on last attempt)
|
||||
if [ $i -lt $MAX_RETRIES ]; then
|
||||
sleep 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
# All retries failed
|
||||
${pkgs.libnotify}/bin/notify-send -u critical "Volume Control Error" "Failed to toggle mute after $MAX_RETRIES attempts"
|
||||
exit 1
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.home.roles.plasma-manager-kodi = {
|
||||
enable = mkEnableOption "KDE Plasma volume control for kodi user via Home Assistant";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.plasma = {
|
||||
enable = true;
|
||||
overrideConfig = true;
|
||||
|
||||
# Disable default kmix volume shortcuts to prevent conflicts
|
||||
shortcuts.kmix = {
|
||||
"increase_volume" = "none";
|
||||
"decrease_volume" = "none";
|
||||
"mute" = "none";
|
||||
};
|
||||
|
||||
# Define custom volume control commands with key bindings
|
||||
hotkeys.commands = {
|
||||
"volume-up-avr" = {
|
||||
name = "Volume Up AVR";
|
||||
key = "Volume Up";
|
||||
command = toString volumeUpScript;
|
||||
};
|
||||
|
||||
"volume-down-avr" = {
|
||||
name = "Volume Down AVR";
|
||||
key = "Volume Down";
|
||||
command = toString volumeDownScript;
|
||||
};
|
||||
|
||||
"volume-mute-avr" = {
|
||||
name = "Mute Toggle AVR";
|
||||
key = "Volume Mute";
|
||||
command = toString volumeMuteScript;
|
||||
};
|
||||
};
|
||||
|
||||
# KDE Settings customization
|
||||
configFile = {
|
||||
# Session restore settings
|
||||
"ksmserverrc"."General"."loginMode" = "emptySession";
|
||||
|
||||
# Screen locking settings
|
||||
"kscreenlockerrc"."Daemon"."Autolock" = false;
|
||||
"kscreenlockerrc"."Daemon"."LockOnResume" = false;
|
||||
|
||||
# Theme settings
|
||||
"kdeglobals"."KDE"."LookAndFeelPackage" = "org.kde.breezedark.desktop";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
190
home/roles/plasma-manager/default.nix
Normal file
@@ -0,0 +1,190 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.plasma-manager;
|
||||
wallpaperConfig = import ../../wallpapers;
|
||||
currentWallpaper = builtins.elemAt wallpaperConfig.wallpapers wallpaperConfig.currentIndex;
|
||||
in
|
||||
{
|
||||
options.home.roles.plasma-manager = {
|
||||
enable = mkEnableOption "KDE Plasma desktop environment configuration";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# The current KDE config can be output with the command:
|
||||
# nix run github:nix-community/plasma-manager
|
||||
#
|
||||
# Plasma-manager options documentation
|
||||
# https://nix-community.github.io/plasma-manager/options.xhtml
|
||||
#
|
||||
# TODO: (ambitious) Add Kmail support to plasma-manager
|
||||
programs.plasma = {
|
||||
enable = true;
|
||||
overrideConfig = true;
|
||||
|
||||
hotkeys.commands."launch-ghostty" = {
|
||||
name = "Launch Ghostty";
|
||||
key = "Meta+Return";
|
||||
command = "ghostty";
|
||||
};
|
||||
|
||||
shortcuts = {
|
||||
kmix = {
|
||||
"decrease_microphone_volume" = "Microphone Volume Down";
|
||||
"decrease_volume" = "Volume Down";
|
||||
"decrease_volume_small" = "Shift+Volume Down";
|
||||
"increase_microphone_volume" = "Microphone Volume Up";
|
||||
"increase_volume" = "Volume Up";
|
||||
"increase_volume_small" = "Shift+Volume Up";
|
||||
"mic_mute" = ["Microphone Mute" "Meta+Volume Mute,Microphone Mute" "Meta+Volume Mute,Mute Microphone"];
|
||||
"mute" = "Volume Mute";
|
||||
};
|
||||
|
||||
mediacontrol = {
|
||||
"mediavolumedown" = "none,,Media volume down";
|
||||
"mediavolumeup" = "none,,Media volume up";
|
||||
"nextmedia" = "Media Next";
|
||||
"pausemedia" = "Media Pause";
|
||||
"playmedia" = "none,,Play media playback";
|
||||
"playpausemedia" = "Media Play";
|
||||
"previousmedia" = "Media Previous";
|
||||
"stopmedia" = "Media Stop";
|
||||
};
|
||||
|
||||
ksmserver = {
|
||||
"Lock Session" = ["Meta+Ctrl+Q" "Screensaver" "Screensaver,Lock Session"];
|
||||
};
|
||||
|
||||
kwin = {
|
||||
"Window Close" = "Meta+Shift+Q";
|
||||
"Kill Window" = "Meta+Ctrl+Esc";
|
||||
"Window Operations Menu" = "Alt+F3";
|
||||
"Window Resize" = "Meta+R,,Resize Window";
|
||||
|
||||
"Overview" = "Meta+Ctrl+W";
|
||||
"Grid View" = "Meta+G";
|
||||
"Edit Tiles" = "Meta+T";
|
||||
|
||||
"Activate Window Demanding Attention" = "Meta+Ctrl+A";
|
||||
|
||||
"Show Desktop" = "Meta+Ctrl+D";
|
||||
|
||||
"Walk Through Windows" = "Alt+Tab";
|
||||
"Walk Through Windows (Reverse)" = "Alt+Shift+Tab";
|
||||
"Walk Through Windows of Current Application" = "Alt+`";
|
||||
"Walk Through Windows of Current Application (Reverse)" = "Alt+~";
|
||||
|
||||
"Window Quick Tile Bottom" = "Meta+Down";
|
||||
"Window Quick Tile Left" = "Meta+Left";
|
||||
"Window Quick Tile Right" = "Meta+Right";
|
||||
"Window Quick Tile Top" = "Meta+Up";
|
||||
|
||||
"Switch to Desktop 1" = "Meta+1";
|
||||
"Switch to Desktop 2" = "Meta+2";
|
||||
"Switch to Desktop 3" = "Meta+3";
|
||||
"Switch to Desktop 4" = "Meta+4";
|
||||
"Switch to Desktop 5" = "Meta+5";
|
||||
"Switch to Desktop 6" = "Meta+6";
|
||||
"Switch to Desktop 7" = "Meta+7";
|
||||
"Switch to Desktop 8" = "Meta+8";
|
||||
"Switch to Desktop 9" = "Meta+9";
|
||||
"Switch to Desktop 10" = "Meta+0";
|
||||
|
||||
"Window to Desktop 1" = "Meta+!"; # Meta+Shift+1
|
||||
"Window to Desktop 2" = "Meta+@"; # Meta+Shift+2
|
||||
"Window to Desktop 3" = "Meta+#"; # Meta+Shift+3
|
||||
"Window to Desktop 4" = "Meta+$"; # Meta+Shift+4
|
||||
"Window to Desktop 5" = "Meta+%"; # Meta+Shift+5
|
||||
"Window to Desktop 6" = "Meta+^"; # Meta+Shift+6
|
||||
"Window to Desktop 7" = "Meta+&"; # Meta+Shift+7
|
||||
"Window to Desktop 8" = "Meta+*"; # Meta+Shift+8
|
||||
"Window to Desktop 9" = "Meta+("; # Meta+Shift+9
|
||||
"Window to Desktop 10" = "Meta+)"; # Meta+Shift+0
|
||||
|
||||
"view_actual_size" = "Meta+Ctrl+=";
|
||||
"view_zoom_in" = ["Meta++" "Meta+=,Meta++" "Meta+=,Zoom In"];
|
||||
"view_zoom_out" = "Meta+-";
|
||||
};
|
||||
"org_kde_powerdevil"."Decrease Keyboard Brightness" = "Keyboard Brightness Down";
|
||||
"org_kde_powerdevil"."Decrease Screen Brightness" = "Monitor Brightness Down";
|
||||
"org_kde_powerdevil"."Decrease Screen Brightness Small" = "Shift+Monitor Brightness Down";
|
||||
"org_kde_powerdevil"."Hibernate" = "Hibernate";
|
||||
"org_kde_powerdevil"."Increase Keyboard Brightness" = "Keyboard Brightness Up";
|
||||
"org_kde_powerdevil"."Increase Screen Brightness" = "Monitor Brightness Up";
|
||||
"org_kde_powerdevil"."Increase Screen Brightness Small" = "Shift+Monitor Brightness Up";
|
||||
"org_kde_powerdevil"."PowerDown" = "Power Down";
|
||||
"org_kde_powerdevil"."PowerOff" = "Power Off";
|
||||
"org_kde_powerdevil"."Sleep" = "Sleep";
|
||||
"org_kde_powerdevil"."Toggle Keyboard Backlight" = "Keyboard Light On/Off";
|
||||
"org_kde_powerdevil"."Turn Off Screen" = [ ];
|
||||
"org_kde_powerdevil"."powerProfile" = ["Battery" "Meta+B,Battery" "Meta+B,Switch Power Profile"];
|
||||
|
||||
plasmashell = {
|
||||
"activate application launcher" = ["Meta" "Alt+F1,Meta" "Alt+F1,Activate Application Launcher"];
|
||||
"activate task manager entry 1" = "none,,";
|
||||
"activate task manager entry 2" = "none,,";
|
||||
"activate task manager entry 3" = "none,,";
|
||||
"activate task manager entry 4" = "none,,";
|
||||
"activate task manager entry 5" = "none,,";
|
||||
"activate task manager entry 6" = "none,,";
|
||||
"activate task manager entry 7" = "none,,";
|
||||
"activate task manager entry 8" = "none,,";
|
||||
"activate task manager entry 9" = "none,,";
|
||||
"activate task manager entry 10" = "none,,";
|
||||
"show activity switcher" = "none,,";
|
||||
};
|
||||
};
|
||||
|
||||
configFile = {
|
||||
kwinrc.Desktops.Number = {
|
||||
value = 10;
|
||||
immutable = true;
|
||||
};
|
||||
|
||||
# Enable KWin tiling features
|
||||
kwinrc.Tiling = {
|
||||
# Enable tiling functionality
|
||||
"padding" = 4;
|
||||
};
|
||||
|
||||
# Enable krohnkite plugin automatically
|
||||
kwinrc.Plugins = {
|
||||
krohnkiteEnabled = true;
|
||||
};
|
||||
|
||||
kwinrc.Effect-overview = {
|
||||
# Configure overview effect for better tiling workflow
|
||||
BorderActivate = 9; # Top-left corner activation
|
||||
};
|
||||
|
||||
kcminputrc.Libinput = {
|
||||
AccelerationProfile = "adaptive";
|
||||
PointerAcceleration = 0.5;
|
||||
};
|
||||
|
||||
kcminputrc.Mouse = {
|
||||
X11LibInputXAccelProfileFlat = false;
|
||||
XLbInptAccelProfileFlat = false;
|
||||
};
|
||||
|
||||
kdeglobals.KDE.LookAndFeelPackage = "org.kde.breezedark.desktop";
|
||||
|
||||
# Focus follows mouse configuration
|
||||
kwinrc.Windows = {
|
||||
FocusPolicy = "FocusFollowsMouse";
|
||||
AutoRaise = true; # Set to true if you want windows to auto-raise on focus
|
||||
AutoRaiseInterval = 750; # Delay in ms before auto-raise (if enabled)
|
||||
DelayFocusInterval = 0; # Delay in ms before focus follows mouse
|
||||
};
|
||||
|
||||
# Desktop wallpaper configuration
|
||||
plasma-localerc.Formats.LANG = "en_US.UTF-8";
|
||||
|
||||
# Set wallpaper for all desktops
|
||||
plasmarc.Wallpapers.usersWallpapers = "${currentWallpaper.file}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
72
home/roles/starship/default.nix
Normal file
@@ -0,0 +1,72 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.starship;
|
||||
in
|
||||
{
|
||||
options.home.roles.starship = {
|
||||
enable = mkEnableOption "starship cross-shell prompt";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
add_newline = true;
|
||||
|
||||
character = {
|
||||
success_symbol = "[>](bold green)";
|
||||
error_symbol = "[x](bold red)";
|
||||
vimcmd_symbol = "[<](bold green)";
|
||||
};
|
||||
|
||||
directory = {
|
||||
truncation_length = 4;
|
||||
truncate_to_repo = true;
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
symbol = "";
|
||||
format = "[$symbol$branch(:$remote_branch)]($style) ";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
format = "([$all_status$ahead_behind]($style) )";
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
symbol = "";
|
||||
format = "[$symbol$state( \\($name\\))]($style) ";
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
min_time = 2000;
|
||||
format = "[$duration]($style) ";
|
||||
};
|
||||
|
||||
# Disable modules that are noisy or rarely needed
|
||||
package.disabled = true;
|
||||
nodejs.disabled = true;
|
||||
python.disabled = true;
|
||||
ruby.disabled = true;
|
||||
java.disabled = true;
|
||||
golang.disabled = true;
|
||||
rust.disabled = true;
|
||||
php.disabled = true;
|
||||
lua.disabled = true;
|
||||
perl.disabled = true;
|
||||
terraform.disabled = true;
|
||||
kubernetes.disabled = true;
|
||||
docker_context.disabled = true;
|
||||
aws.disabled = true;
|
||||
gcloud.disabled = true;
|
||||
azure.disabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
24
home/roles/sync/default.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.sync;
|
||||
isLinux = pkgs.stdenv.isLinux;
|
||||
in
|
||||
{
|
||||
options.home.roles.sync = {
|
||||
enable = mkEnableOption "Enable file synchronization services";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Linux-only: syncthingtray requires system tray support
|
||||
home.packages = optionals isLinux (with pkgs; [
|
||||
syncthingtray
|
||||
]);
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
62
home/roles/tmux/default.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.home.roles.tmux;
|
||||
|
||||
tokyo-night = pkgs.tmuxPlugins.mkTmuxPlugin {
|
||||
pluginName = "tokyo-night";
|
||||
rtpFilePath = "tokyo-night.tmux";
|
||||
version = "1.6.1";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "janoamaral";
|
||||
repo = "tokyo-night-tmux";
|
||||
rev = "d610ced20d5f602a7995854931440e4a1e0ab780";
|
||||
sha256 = "sha256-17vEgkL7C51p/l5gpT9dkOy0bY9n8l0/LV51mR1k+V8=";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.home.roles.tmux = {
|
||||
enable = mkEnableOption "tmux terminal multiplexer with Tokyo Night theme";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.tmux.enable = true;
|
||||
programs.tmux.terminal = "tmux-direct";
|
||||
programs.tmux.keyMode = "vi";
|
||||
programs.tmux.escapeTime = 0;
|
||||
programs.tmux.mouse = true;
|
||||
programs.tmux.newSession = true;
|
||||
programs.tmux.historyLimit = 50000;
|
||||
programs.tmux.clock24 = true;
|
||||
programs.tmux.baseIndex = 1;
|
||||
programs.tmux.prefix = "M-\\\\";
|
||||
|
||||
programs.tmux.plugins = with pkgs; [
|
||||
tmuxPlugins.cpu
|
||||
tmuxPlugins.battery
|
||||
tmuxPlugins.better-mouse-mode
|
||||
tmuxPlugins.net-speed
|
||||
tmuxPlugins.online-status
|
||||
tmuxPlugins.pain-control
|
||||
tmuxPlugins.tilish
|
||||
tmuxPlugins.yank
|
||||
|
||||
{
|
||||
plugin = tmuxPlugins.resurrect;
|
||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||
}
|
||||
{
|
||||
plugin = tmuxPlugins.continuum;
|
||||
extraConfig = ''
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-save-interval '15' # minutes
|
||||
'';
|
||||
}
|
||||
|
||||
tokyo-night
|
||||
];
|
||||
};
|
||||
}
|
||||
45
home/wallpapers/default.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
# Wallpaper rotation system
|
||||
# The currentIndex is incremented by `nix run .#rotate-wallpaper`
|
||||
# and gets committed as part of `nix run .#upgrade`
|
||||
{
|
||||
currentIndex = 1; # Index into wallpapers list
|
||||
|
||||
wallpapers = [
|
||||
{
|
||||
name = "metroid-samus-returns";
|
||||
file = ./metroid-samus-returns-kz-3440x1440.jpg;
|
||||
sway = "fill";
|
||||
feh = "--bg-fill";
|
||||
}
|
||||
{
|
||||
name = "metroid3_map";
|
||||
file = ./metroid3_map.gif;
|
||||
sway = "fit";
|
||||
feh = "--bg-max";
|
||||
}
|
||||
{
|
||||
name = "super-metroid-gunship-cavern";
|
||||
file = ./super-metroid-gunship-cavern.jpg;
|
||||
sway = "fit";
|
||||
feh = "--bg-max";
|
||||
}
|
||||
{
|
||||
name = "super-metroid-samus-statue";
|
||||
file = ./super-metroid-samus-statue.png;
|
||||
sway = "fit";
|
||||
feh = "--bg-max";
|
||||
}
|
||||
{
|
||||
name = "metroid-samus-action-4k";
|
||||
file = ./metroid-samus-action-4k.jpg;
|
||||
sway = "fit";
|
||||
feh = "--bg-max";
|
||||
}
|
||||
{
|
||||
name = "metroid-creature-minimalist";
|
||||
file = ./metroid-creature-minimalist.jpg;
|
||||
sway = "fit";
|
||||
feh = "--bg-max";
|
||||
}
|
||||
];
|
||||
}
|
||||
BIN
home/wallpapers/metroid-creature-minimalist.jpg
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
home/wallpapers/metroid-samus-action-4k.jpg
Normal file
|
After Width: | Height: | Size: 9.2 MiB |
BIN
home/wallpapers/metroid-samus-returns-kz-3440x1440.jpg
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
home/wallpapers/metroid3_map.gif
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
home/wallpapers/super-metroid-gunship-cavern.jpg
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
home/wallpapers/super-metroid-samus-statue.png
Normal file
|
After Width: | Height: | Size: 5.8 MiB |
@@ -2,7 +2,7 @@
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ lib, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -14,23 +14,43 @@ with lib;
|
||||
|
||||
roles = {
|
||||
audio.enable = true;
|
||||
bluetooth.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
gaming.enable = true;
|
||||
kde = true;
|
||||
sddm = true;
|
||||
wayland = true;
|
||||
};
|
||||
kodi = {
|
||||
enable = true;
|
||||
autologin = true;
|
||||
wayland = true;
|
||||
appLauncherServer.enable = true;
|
||||
jellyfinScaleFactor = 1.0;
|
||||
};
|
||||
nfs-mounts.enable = true;
|
||||
users.enable = true;
|
||||
};
|
||||
|
||||
# Enable KDE Wallet PAM integration for auto-unlock
|
||||
security.pam.services.sddm = {
|
||||
kwallet = {
|
||||
enable = true;
|
||||
package = pkgs.kdePackages.kwallet-pam;
|
||||
};
|
||||
};
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "boxy"; # Define your hostname.
|
||||
|
||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||
hardware.graphics.enable = true;
|
||||
|
||||
services.displayManager.enable = mkForce false;
|
||||
hardware.graphics.enable32Bit = true;
|
||||
# RADV (AMD's Vulkan driver) is now enabled by default, amdvlk was removed
|
||||
|
||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
|
||||
424
machines/john-endesktop/MIGRATION_PLAN.md
Normal file
@@ -0,0 +1,424 @@
|
||||
# Migration Plan: Arch Linux to NixOS on john-endesktop (ZFS/NFS Server)
|
||||
|
||||
## Overview
|
||||
This document outlines the plan to migrate the john-endesktop server from Arch Linux to NixOS while maintaining the existing ZFS pools and NFS exports that serve your k3s cluster.
|
||||
|
||||
## Current System State
|
||||
|
||||
### Hardware
|
||||
- **Boot disk**: nvme0n1
|
||||
- nvme0n1p3: 1000M EFI partition (UUID: F5C6-D570)
|
||||
- nvme0n1p4: 120GB ext4 / (current Arch root)
|
||||
- nvme0n1p5: 810GB - **Target for NixOS** (being removed from media pool)
|
||||
- **Network**: enp0s31f6 @ 10.0.0.43/24 (DHCP)
|
||||
|
||||
### ZFS Pools
|
||||
- **media**: ~3.5TB JBOD pool (2 drives after nvme0n1p5 removal)
|
||||
- wwn-0x50014ee2ba653d70-part2
|
||||
- ata-WDC_WD20EZBX-00AYRA0_WD-WX62D627X7Z8-part2
|
||||
- Contains: /media/media/nix (bind mounted to /nix on Arch)
|
||||
- NFS: Shared to 10.0.0.0/24 via ZFS sharenfs property
|
||||
|
||||
- **swarmvols**: 928GB mirror pool - **PRODUCTION DATA**
|
||||
- wwn-0x5002538f52707e2d-part2
|
||||
- wwn-0x5002538f52707e81-part2
|
||||
- Contains: iocage jails and k3s persistent volumes
|
||||
- NFS: Shared to 10.0.0.0/24 via ZFS sharenfs property
|
||||
- Backed up nightly to remote borg
|
||||
|
||||
### Services
|
||||
- NFS server exporting /media and /swarmvols to k3s cluster
|
||||
- ZFS managing pools with automatic exports via sharenfs property
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Before Starting
|
||||
1. ✅ Ensure nvme0n1p5 removal from media pool is complete
|
||||
```bash
|
||||
ssh 10.0.0.43 "zpool status media"
|
||||
# Should show no "removing" devices
|
||||
```
|
||||
|
||||
2. ✅ Verify recent backups exist
|
||||
```bash
|
||||
# Verify swarmvols backup is recent (< 24 hours)
|
||||
# Check your borg backup system
|
||||
```
|
||||
|
||||
3. ✅ Notify k3s cluster users of planned maintenance window
|
||||
- NFS shares will be unavailable during migration
|
||||
- Estimate: 30-60 minutes downtime
|
||||
|
||||
4. ✅ Build NixOS configuration from your workstation
|
||||
```bash
|
||||
cd ~/nixos-configs
|
||||
nix build .#nixosConfigurations.john-endesktop.config.system.build.toplevel
|
||||
```
|
||||
|
||||
## Migration Steps
|
||||
|
||||
### Phase 1: Prepare NixOS Installation Media
|
||||
|
||||
1. **Download NixOS minimal ISO**
|
||||
```bash
|
||||
wget https://channels.nixos.org/nixos-25.11/latest-nixos-minimal-x86_64-linux.iso
|
||||
```
|
||||
|
||||
2. **Create bootable USB**
|
||||
```bash
|
||||
# Identify USB device (e.g., /dev/sdb)
|
||||
lsblk
|
||||
# Write ISO to USB
|
||||
sudo dd if=latest-nixos-minimal-x86_64-linux.iso of=/dev/sdX bs=4M status=progress
|
||||
sudo sync
|
||||
```
|
||||
|
||||
### Phase 2: Backup and Shutdown
|
||||
|
||||
1. **On the server, verify ZFS pool status**
|
||||
```bash
|
||||
ssh 10.0.0.43 "zpool status"
|
||||
ssh 10.0.0.43 "zfs list"
|
||||
```
|
||||
|
||||
2. **Export ZFS pools cleanly**
|
||||
```bash
|
||||
ssh 10.0.0.43 "sudo zpool export media"
|
||||
ssh 10.0.0.43 "sudo zpool export swarmvols"
|
||||
```
|
||||
|
||||
3. **Shutdown Arch Linux**
|
||||
```bash
|
||||
ssh 10.0.0.43 "sudo shutdown -h now"
|
||||
```
|
||||
|
||||
### Phase 3: Install NixOS
|
||||
|
||||
1. **Boot from NixOS USB**
|
||||
- Insert USB drive
|
||||
- Power on and select USB in boot menu
|
||||
|
||||
2. **Connect to network**
|
||||
```bash
|
||||
# If DHCP doesn't work automatically:
|
||||
sudo systemctl start dhcpcd
|
||||
ip a # Verify you have 10.0.0.43 or another IP
|
||||
```
|
||||
|
||||
3. **Enable SSH for remote installation (recommended)**
|
||||
```bash
|
||||
# Set password for nixos user
|
||||
sudo passwd nixos
|
||||
# Start SSH
|
||||
sudo systemctl start sshd
|
||||
# From your workstation:
|
||||
ssh nixos@10.0.0.43
|
||||
```
|
||||
|
||||
4. **Partition nvme0n1p5 with btrfs**
|
||||
```bash
|
||||
# Verify the device is clear
|
||||
lsblk
|
||||
sudo wipefs -a /dev/nvme0n1p5
|
||||
|
||||
# Create btrfs filesystem
|
||||
sudo mkfs.btrfs -L nixos /dev/nvme0n1p5
|
||||
|
||||
# Mount and create subvolumes
|
||||
sudo mount /dev/nvme0n1p5 /mnt
|
||||
sudo btrfs subvolume create /mnt/@
|
||||
sudo btrfs subvolume create /mnt/@home
|
||||
sudo btrfs subvolume create /mnt/@nix
|
||||
sudo btrfs subvolume create /mnt/@log
|
||||
sudo umount /mnt
|
||||
|
||||
# Mount root subvolume
|
||||
sudo mount -o subvol=@,compress=zstd,noatime /dev/nvme0n1p5 /mnt
|
||||
|
||||
# Create mount points
|
||||
sudo mkdir -p /mnt/{boot,home,nix,var/log}
|
||||
|
||||
# Mount other subvolumes
|
||||
sudo mount -o subvol=@home,compress=zstd,noatime /dev/nvme0n1p5 /mnt/home
|
||||
sudo mount -o subvol=@nix,compress=zstd,noatime /dev/nvme0n1p5 /mnt/nix
|
||||
sudo mount -o subvol=@log,compress=zstd,noatime /dev/nvme0n1p5 /mnt/var/log
|
||||
|
||||
# Mount EFI partition
|
||||
sudo mount /dev/nvme0n1p3 /mnt/boot
|
||||
```
|
||||
|
||||
5. **Import ZFS pools**
|
||||
```bash
|
||||
# Import pools (should be visible)
|
||||
sudo zpool import
|
||||
|
||||
# Import with force if needed due to hostid
|
||||
sudo zpool import -f media
|
||||
sudo zpool import -f swarmvols
|
||||
|
||||
# Verify pools are mounted
|
||||
zfs list
|
||||
ls -la /media /swarmvols
|
||||
```
|
||||
|
||||
6. **Generate initial hardware configuration**
|
||||
```bash
|
||||
sudo nixos-generate-config --root /mnt
|
||||
```
|
||||
|
||||
7. **Get the new root filesystem UUID**
|
||||
```bash
|
||||
blkid /dev/nvme0n1p5
|
||||
# Note the UUID for updating hardware-configuration.nix
|
||||
/dev/nvme0n1p5: LABEL="nixos" UUID="5f4ad025-bfab-4aed-a933-6638348059e5" UUID_SUB="4734d820-7b8a-4b7f-853a-026021c1d204" BLOCK_SIZE="4096" TYPE="btrfs" PARTLABEL="data" PARTUUID="9ea025df-cdb7-48fd-b5d4-37cd5d8588eb"
|
||||
```
|
||||
|
||||
8. **Copy your NixOS configuration to the server**
|
||||
```bash
|
||||
# From your workstation:
|
||||
scp -r ~/nixos-configs/machines/john-endesktop/* nixos@10.0.0.43:/tmp/
|
||||
|
||||
# On server:
|
||||
sudo mkdir -p /mnt/etc/nixos
|
||||
sudo cp /tmp/configuration.nix /mnt/etc/nixos/
|
||||
sudo cp /tmp/hardware-configuration.nix /mnt/etc/nixos/
|
||||
|
||||
# Edit hardware-configuration.nix to update the root filesystem UUID
|
||||
sudo nano /mnt/etc/nixos/hardware-configuration.nix
|
||||
# Change: device = "/dev/disk/by-uuid/CHANGE-THIS-TO-YOUR-UUID";
|
||||
# To: device = "/dev/disk/by-uuid/[UUID from blkid]";
|
||||
```
|
||||
|
||||
9. **Install NixOS**
|
||||
```bash
|
||||
sudo nixos-install
|
||||
|
||||
# Set root password when prompted
|
||||
# Set user password
|
||||
sudo nixos-install --no-root-passwd
|
||||
```
|
||||
|
||||
10. **Reboot into NixOS**
|
||||
```bash
|
||||
sudo reboot
|
||||
# Remove USB drive
|
||||
```
|
||||
|
||||
### Phase 4: Post-Installation Verification
|
||||
|
||||
1. **Boot into NixOS and verify system**
|
||||
```bash
|
||||
ssh johno@10.0.0.43
|
||||
|
||||
# Check NixOS version
|
||||
nixos-version
|
||||
|
||||
# Verify hostname
|
||||
hostname # Should be: john-endesktop
|
||||
```
|
||||
|
||||
2. **Verify ZFS pools imported correctly**
|
||||
```bash
|
||||
zpool status
|
||||
zpool list
|
||||
zfs list
|
||||
|
||||
# Check for hostid mismatch warnings (should be gone)
|
||||
# Verify both pools show ONLINE status
|
||||
```
|
||||
|
||||
3. **Verify NFS exports are active**
|
||||
```bash
|
||||
sudo exportfs -v
|
||||
systemctl status nfs-server
|
||||
|
||||
# Should see /media and /swarmvols exported to 10.0.0.0/24
|
||||
```
|
||||
|
||||
4. **Test NFS mount from another machine**
|
||||
```bash
|
||||
# From a k3s node or your workstation:
|
||||
sudo mount -t nfs 10.0.0.43:/swarmvols /mnt
|
||||
ls -la /mnt
|
||||
sudo umount /mnt
|
||||
|
||||
sudo mount -t nfs 10.0.0.43:/media /mnt
|
||||
ls -la /mnt
|
||||
sudo umount /mnt
|
||||
```
|
||||
|
||||
5. **Verify ZFS sharenfs properties preserved**
|
||||
```bash
|
||||
zfs get sharenfs media
|
||||
zfs get sharenfs swarmvols
|
||||
|
||||
# Should show: sec=sys,mountpoint,no_subtree_check,no_root_squash,rw=@10.0.0.0/24
|
||||
```
|
||||
|
||||
6. **Check swap device**
|
||||
```bash
|
||||
swapon --show
|
||||
free -h
|
||||
# Should show /dev/zvol/media/swap
|
||||
```
|
||||
|
||||
### Phase 5: Restore k3s Cluster Access
|
||||
|
||||
1. **Restart k3s nodes or remount NFS shares**
|
||||
```bash
|
||||
# On each k3s node:
|
||||
sudo systemctl restart k3s # or k3s-agent
|
||||
```
|
||||
|
||||
2. **Verify k3s pods have access to persistent volumes**
|
||||
```bash
|
||||
# On k3s master:
|
||||
kubectl get pv
|
||||
kubectl get pvc
|
||||
# Check that volumes are bound and accessible
|
||||
```
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
If something goes wrong during migration, you can roll back to Arch Linux:
|
||||
|
||||
### Quick Rollback (If NixOS won't boot)
|
||||
|
||||
1. **Boot from NixOS USB (or Arch USB)**
|
||||
|
||||
2. **Import ZFS pools**
|
||||
```bash
|
||||
sudo zpool import -f media
|
||||
sudo zpool import -f swarmvols
|
||||
```
|
||||
|
||||
3. **Start NFS manually (temporary)**
|
||||
```bash
|
||||
sudo mkdir -p /media /swarmvols
|
||||
sudo systemctl start nfs-server
|
||||
sudo exportfs -o rw,sync,no_subtree_check,no_root_squash 10.0.0.0/24:/media
|
||||
sudo exportfs -o rw,sync,no_subtree_check,no_root_squash 10.0.0.0/24:/swarmvols
|
||||
sudo exportfs -v
|
||||
```
|
||||
This will restore k3s cluster access immediately while you diagnose.
|
||||
|
||||
4. **Boot back into Arch Linux**
|
||||
```bash
|
||||
# Reboot and select nvme0n1p4 (Arch) in GRUB/boot menu
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
5. **Verify Arch boots and services start**
|
||||
```bash
|
||||
ssh johno@10.0.0.43
|
||||
zpool status
|
||||
systemctl status nfs-server
|
||||
```
|
||||
|
||||
### Full Rollback (If needed)
|
||||
|
||||
1. **Follow Quick Rollback steps above**
|
||||
|
||||
2. **Re-add nvme0n1p5 to media pool (if desired)**
|
||||
```bash
|
||||
# Only if you want to restore the original configuration
|
||||
sudo zpool add media /dev/nvme0n1p5
|
||||
```
|
||||
|
||||
3. **Clean up NixOS partition**
|
||||
```bash
|
||||
# If you want to reclaim nvme0n1p5 for other uses
|
||||
sudo wipefs -a /dev/nvme0n1p5
|
||||
```
|
||||
|
||||
## Risk Mitigation
|
||||
|
||||
### Data Safety
|
||||
- ✅ **swarmvols** (production): Mirrored + nightly borg backups
|
||||
- ⚠️ **media** (important): JBOD - no redundancy, but not catastrophic
|
||||
- ✅ **NixOS install**: Separate partition, doesn't touch ZFS pools
|
||||
- ✅ **Arch Linux**: Remains bootable on nvme0n1p4 until verified
|
||||
|
||||
### Service Continuity
|
||||
- Downtime: 30-60 minutes expected
|
||||
- k3s cluster: Will reconnect automatically when NFS returns
|
||||
- Rollback time: < 10 minutes to restore Arch
|
||||
|
||||
### Testing Approach
|
||||
1. Test NFS exports from NixOS live environment before installation
|
||||
2. Test single NFS mount from k3s node before full cluster restart
|
||||
3. Keep Arch Linux boot option until 24-48 hours of stable NixOS operation
|
||||
|
||||
## Post-Migration Tasks
|
||||
|
||||
After successful migration and 24-48 hours of stable operation:
|
||||
|
||||
1. **Update k3s NFS mounts (if needed)**
|
||||
- Verify no hardcoded references to old system
|
||||
|
||||
2. **Optional: Repurpose Arch partition**
|
||||
```bash
|
||||
# After you're confident NixOS is stable
|
||||
# You can wipe nvme0n1p4 and repurpose it
|
||||
```
|
||||
|
||||
3. **Update documentation**
|
||||
- Update infrastructure docs with NixOS configuration
|
||||
- Document any deviations from this plan
|
||||
|
||||
4. **Consider setting up NixOS remote deployment**
|
||||
```bash
|
||||
# From your workstation:
|
||||
nixos-rebuild switch --target-host johno@10.0.0.43 --flake .#john-endesktop
|
||||
```
|
||||
|
||||
## Timeline
|
||||
|
||||
- **Preparation**: 1-2 hours (testing config build, downloading ISO)
|
||||
- **Migration window**: 1-2 hours (installation + verification)
|
||||
- **Verification period**: 24-48 hours (before removing Arch)
|
||||
- **Total**: ~3 days from start to declaring success
|
||||
|
||||
## Emergency Contacts
|
||||
|
||||
- Borg backup location: [Document your borg repo location]
|
||||
- K3s cluster nodes: [Document your k3s nodes]
|
||||
- Critical services on k3s: [Document what's running that depends on these NFS shares]
|
||||
|
||||
## Checklist
|
||||
|
||||
Pre-migration:
|
||||
- [x] nvme0n1p5 removal from media pool complete
|
||||
- [x] Recent backup verified (< 24 hours)
|
||||
- [x] Maintenance window scheduled
|
||||
- [x] NixOS ISO downloaded
|
||||
- [x] Bootable USB created
|
||||
- [x] NixOS config builds successfully
|
||||
|
||||
During migration:
|
||||
- [ ] ZFS pools exported
|
||||
- [ ] Arch Linux shutdown cleanly
|
||||
- [ ] Booted from NixOS USB
|
||||
- [ ] nvme0n1p5 formatted with btrfs
|
||||
- [ ] Btrfs subvolumes created
|
||||
- [ ] ZFS pools imported
|
||||
- [ ] NixOS installed
|
||||
- [ ] Root password set
|
||||
|
||||
Post-migration:
|
||||
- [ ] NixOS boots successfully
|
||||
- [ ] ZFS pools mounted automatically
|
||||
- [ ] NFS server running
|
||||
- [ ] NFS exports verified
|
||||
- [ ] Test mount from k3s node successful
|
||||
- [ ] k3s cluster reconnected
|
||||
- [ ] Persistent volumes accessible
|
||||
- [ ] No hostid warnings in zpool status
|
||||
- [ ] Arch Linux still bootable (for rollback)
|
||||
|
||||
Final verification (after 24-48 hours):
|
||||
- [ ] All services stable
|
||||
- [ ] No unexpected issues
|
||||
- [ ] Performance acceptable
|
||||
- [ ] Ready to remove Arch partition (optional)
|
||||
- [ ] Ready to remove /swarmvols/media-backup (optional)
|
||||
156
machines/john-endesktop/configuration.nix
Normal file
@@ -0,0 +1,156 @@
|
||||
# NixOS configuration for john-endesktop (ZFS/NFS server)
|
||||
# Migrated from Arch Linux to provide ZFS pools via NFS to k3s cluster
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# Boot configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# ZFS support
|
||||
boot.supportedFilesystems = [ "zfs" ];
|
||||
boot.zfs.forceImportRoot = false;
|
||||
boot.zfs.extraPools = [ "media" "swarmvols" ];
|
||||
|
||||
# Set ZFS hostid to match current system (from Arch Linux)
|
||||
# This resolves the hostid mismatch warnings
|
||||
networking.hostId = "007f0101";
|
||||
|
||||
# Hostname
|
||||
networking.hostName = "john-endesktop";
|
||||
|
||||
# Network configuration - using DHCP on enp0s31f6
|
||||
networking.useDHCP = false;
|
||||
networking.interfaces.enp0s31f6.useDHCP = true;
|
||||
|
||||
# NFS Server configuration
|
||||
services.nfs.server = {
|
||||
enable = true;
|
||||
|
||||
# NFS protocol versions
|
||||
# v3 for broader compatibility, v4 for better performance
|
||||
exports = ''
|
||||
# These are managed by ZFS sharenfs properties
|
||||
# but we enable the NFS server here
|
||||
'';
|
||||
};
|
||||
|
||||
# Enable NFS4 with proper configuration
|
||||
services.rpcbind.enable = true;
|
||||
|
||||
# Firewall configuration for NFS
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [
|
||||
111 # rpcbind
|
||||
2049 # nfs
|
||||
4000 # nfs callback
|
||||
4001 # nlockmgr
|
||||
4002 # mountd
|
||||
20048 # mountd
|
||||
];
|
||||
allowedUDPPorts = [
|
||||
111 # rpcbind
|
||||
2049 # nfs
|
||||
4000 # nfs callback
|
||||
4001 # nlockmgr
|
||||
4002 # mountd
|
||||
20048 # mountd
|
||||
];
|
||||
# Allow NFS from local network
|
||||
extraCommands = ''
|
||||
iptables -A nixos-fw -p tcp -s 10.0.0.0/24 -j ACCEPT
|
||||
iptables -A nixos-fw -p udp -s 10.0.0.0/24 -j ACCEPT
|
||||
'';
|
||||
};
|
||||
|
||||
# ZFS maintenance
|
||||
services.zfs = {
|
||||
autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
};
|
||||
trim = {
|
||||
enable = true;
|
||||
interval = "weekly";
|
||||
};
|
||||
};
|
||||
|
||||
# Basic system packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
htop
|
||||
tmux
|
||||
zfs
|
||||
rclone
|
||||
custom.rclone-torbox-setup # Helper script to set up TorBox credentials via rbw
|
||||
];
|
||||
|
||||
# Enable SSH
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = true;
|
||||
};
|
||||
};
|
||||
|
||||
# User configuration
|
||||
roles.users.enable = true;
|
||||
|
||||
# Enable as remote builder (similar to zix790prors)
|
||||
roles.remote-build.enableBuilder = true;
|
||||
|
||||
# k3s agent configuration
|
||||
roles.k3s-node = {
|
||||
enable = true;
|
||||
role = "agent";
|
||||
# serverAddr defaults to https://10.0.0.222:6443
|
||||
# tokenFile defaults to /etc/k3s/token
|
||||
extraFlags = [
|
||||
# Node labels for workload scheduling
|
||||
# fast-cpu: This node has a faster CPU than other cluster nodes
|
||||
"--node-label=fast-cpu=true"
|
||||
# fast-storage: This node is the NFS host with fast local storage access
|
||||
"--node-label=fast-storage=true"
|
||||
# k3s-upgrade=disabled: NixOS manages k3s upgrades via Nix, not system-upgrade-controller
|
||||
"--node-label=k3s-upgrade=disabled"
|
||||
];
|
||||
};
|
||||
|
||||
roles.virtualisation.enable = true;
|
||||
|
||||
# TorBox WebDAV mount for rdt-client and Jellyfin
|
||||
roles.rclone-mount = {
|
||||
enable = true;
|
||||
mounts.torbox = {
|
||||
webdavUrl = "https://webdav.torbox.app";
|
||||
username = "john@ogle.fyi"; # TorBox account email
|
||||
mountPoint = "/media/media/torbox-rclone";
|
||||
environmentFile = "/etc/rclone/torbox.env";
|
||||
vfsCacheMode = "full"; # Best for streaming media
|
||||
dirCacheTime = "5m";
|
||||
extraArgs = [
|
||||
"--buffer-size=64M"
|
||||
"--vfs-read-chunk-size=32M"
|
||||
"--vfs-read-chunk-size-limit=off"
|
||||
];
|
||||
# Wait for ZFS media pool to be mounted before starting
|
||||
requiresMountsFor = [ "/media" ];
|
||||
};
|
||||
};
|
||||
|
||||
# Time zone
|
||||
time.timeZone = "America/Los_Angeles"; # Adjust as needed
|
||||
|
||||
# NixOS version
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
63
machines/john-endesktop/hardware-configuration.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
# Hardware configuration for john-endesktop
|
||||
# This file should be regenerated after NixOS installation using:
|
||||
# nixos-generate-config --show-hardware-config
|
||||
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
# Boot configuration
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# File systems - these will need to be updated after installation
|
||||
# The nvme0n1p5 partition will be formatted as btrfs for NixOS root
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/5f4ad025-bfab-4aed-a933-6638348059e5";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@" "compress=zstd" "noatime" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "/dev/disk/by-uuid/5f4ad025-bfab-4aed-a933-6638348059e5";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@home" "compress=zstd" "noatime" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "/dev/disk/by-uuid/5f4ad025-bfab-4aed-a933-6638348059e5";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@nix" "compress=zstd" "noatime" ];
|
||||
};
|
||||
|
||||
fileSystems."/var/log" = {
|
||||
device = "/dev/disk/by-uuid/5f4ad025-bfab-4aed-a933-6638348059e5";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@log" "compress=zstd" "noatime" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
# This should match your current EFI partition
|
||||
device = "/dev/disk/by-uuid/F5C6-D570";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
# ZFS pools - these are imported by ZFS, not managed by fileSystems
|
||||
# The pools should be imported automatically via boot.zfs.extraPools
|
||||
# /media and /swarmvols will be mounted by ZFS
|
||||
|
||||
# No swap needed - 23GB RAM is sufficient for this NFS/ZFS server
|
||||
swapDevices = [ ];
|
||||
|
||||
# CPU microcode
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
# Networking
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
}
|
||||
23
machines/johno-macbookpro/configuration.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Basic system configuration for macOS work laptop
|
||||
system.stateVersion = 6;
|
||||
|
||||
# Set primary user for nix-darwin
|
||||
system.primaryUser = "johno";
|
||||
|
||||
# System preferences (can be expanded later)
|
||||
system.defaults = {
|
||||
dock.autohide = true;
|
||||
finder.AppleShowAllExtensions = true;
|
||||
NSGlobalDomain.AppleShowAllExtensions = true;
|
||||
};
|
||||
|
||||
# TODO: Find a way to not duplicate this
|
||||
launchd.user.envVariables = {
|
||||
# DOOM Emacs environment variables
|
||||
DOOMDIR = "/Users/johno/.config/doom";
|
||||
DOOMLOCALDIR = "/Users/johno/.local/doom";
|
||||
};
|
||||
}
|
||||
91
machines/live-usb/configuration.nix
Normal file
@@ -0,0 +1,91 @@
|
||||
# Live USB ISO configuration for recovery and installation
|
||||
{ pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
# Use minimal installation CD as base
|
||||
(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
];
|
||||
|
||||
# Use roles structure for consistent configuration
|
||||
roles = {
|
||||
audio.enable = true;
|
||||
bluetooth.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
kde = true;
|
||||
x11 = true;
|
||||
wayland = true;
|
||||
sddm = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Allow unfree packages for broader hardware support
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Essential packages for system recovery and installation
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Text editors
|
||||
neovim
|
||||
nano
|
||||
|
||||
# System tools
|
||||
git
|
||||
curl
|
||||
wget
|
||||
htop
|
||||
tree
|
||||
lsof
|
||||
strace
|
||||
|
||||
# Filesystem tools
|
||||
btrfs-progs
|
||||
e2fsprogs
|
||||
xfsprogs
|
||||
ntfs3g
|
||||
dosfstools
|
||||
|
||||
# Network tools
|
||||
networkmanager
|
||||
wirelesstools
|
||||
|
||||
# Hardware tools
|
||||
pciutils
|
||||
usbutils
|
||||
smartmontools
|
||||
|
||||
# Archive tools
|
||||
unzip
|
||||
p7zip
|
||||
|
||||
# Development tools (for quick fixes)
|
||||
gcc
|
||||
binutils
|
||||
];
|
||||
|
||||
# Enable NetworkManager for easy wifi setup
|
||||
networking.networkmanager.enable = true;
|
||||
# Disable wireless networking (conflicts with NetworkManager)
|
||||
networking.wireless.enable = false;
|
||||
|
||||
# Enable SSH daemon for remote access
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PermitRootLogin = "yes";
|
||||
PasswordAuthentication = true;
|
||||
};
|
||||
};
|
||||
|
||||
# ISO customization
|
||||
isoImage = {
|
||||
volumeID = "NIXOS-LIVE";
|
||||
};
|
||||
|
||||
# Enable some useful services
|
||||
services.udisks2.enable = true; # For mounting USB drives
|
||||
|
||||
# Hardware support
|
||||
hardware.enableAllFirmware = true;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
}
|
||||
@@ -12,9 +12,28 @@
|
||||
roles = {
|
||||
audio.enable = true;
|
||||
bluetooth.enable = true;
|
||||
desktop.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
wayland = true;
|
||||
gaming.enable = true;
|
||||
kde = true;
|
||||
sddm = true;
|
||||
};
|
||||
nfs-mounts.enable = true;
|
||||
printing.enable = true;
|
||||
remote-build.builders = [
|
||||
{
|
||||
hostName = "zix790prors.oglehome";
|
||||
maxJobs = 16;
|
||||
speedFactor = 3;
|
||||
}
|
||||
{
|
||||
hostName = "john-endesktop.oglehome";
|
||||
maxJobs = 1;
|
||||
speedFactor = 1;
|
||||
}
|
||||
];
|
||||
spotifyd.enable = true;
|
||||
users = {
|
||||
enable = true;
|
||||
extraGroups = [ "video" ];
|
||||
@@ -27,14 +46,25 @@
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
boot.initrd.luks.devices."luks-b614167b-9045-4234-a441-ac6f60a96d81".device = "/dev/disk/by-uuid/b614167b-9045-4234-a441-ac6f60a96d81";
|
||||
|
||||
services.logind.settings.Login = {
|
||||
HandlePowerKey = "hibernate";
|
||||
HandlePowerKeyLongPress = "poweroff";
|
||||
};
|
||||
|
||||
networking.hostName = "nix-book"; # Define your hostname.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# WireGuard setup
|
||||
networking.wg-quick.interfaces = {
|
||||
ogleNet = {
|
||||
configFile = "/root/Oglehome-VPN-johno-nixbook.conf";
|
||||
};
|
||||
};
|
||||
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
|
||||
@@ -10,15 +10,27 @@
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.initrd.luks.devices."luks-4126fbd4-bd09-4ece-af0d-6fff414c21b3".device = "/dev/disk/by-uuid/4126fbd4-bd09-4ece-af0d-6fff414c21b3";
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/bd396529-e2c4-47cb-b844-8d6ed841f81a";
|
||||
fsType = "ext4";
|
||||
roles.btrfs = {
|
||||
enable = true;
|
||||
filesystems."/dev/disk/by-uuid/223a44e5-91e2-4272-830e-129166042a1d" = {
|
||||
mountpoints = {
|
||||
"/" = {
|
||||
compression = "zstd";
|
||||
extraOptions = [ "noatime" ];
|
||||
};
|
||||
};
|
||||
scrub.enable = true;
|
||||
deduplication = {
|
||||
enable = true;
|
||||
hashTableSizeMB = 32;
|
||||
verbosity = "err";
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."luks-4126fbd4-bd09-4ece-af0d-6fff414c21b3".device = "/dev/disk/by-uuid/4126fbd4-bd09-4ece-af0d-6fff414c21b3";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/7A0B-CF88";
|
||||
@@ -29,6 +41,7 @@
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/ec1f70ea-27b6-4646-ad3b-eac41bd83e3e"; }
|
||||
];
|
||||
zramSwap.enable = true;
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
||||
223
machines/nix-book/nixbook-btrfs-migration.md
Normal file
@@ -0,0 +1,223 @@
|
||||
# NixBook ext4 to btrfs Migration Guide
|
||||
|
||||
## Overview
|
||||
This guide converts your nixbook machine from ext4 to btrfs with zstd compression and beesd deduplication while preserving your LUKS encryption and all data.
|
||||
|
||||
## Current System Info
|
||||
- **Hostname**: nix-book
|
||||
- **Root filesystem**: ext4 on `/dev/disk/by-uuid/bd396529-e2c4-47cb-b844-8d6ed841f81a`
|
||||
- **Encryption**: LUKS with two devices configured
|
||||
- **Current usage**: 138GB used / 225GB total (65% full)
|
||||
- **Free space**: 76GB available (sufficient for conversion)
|
||||
|
||||
## Pre-Migration Checklist
|
||||
|
||||
### 1. Create Full System Backup (CRITICAL)
|
||||
```bash
|
||||
# Boot from NixOS live USB
|
||||
# Mount encrypted filesystem
|
||||
cryptsetup luksOpen /dev/disk/by-uuid/4126fbd4-bd09-4ece-af0d-6fff414c21b3 luks-nixbook
|
||||
mount /dev/mapper/luks-nixbook /mnt
|
||||
|
||||
# Create backup to external drive (adjust target as needed)
|
||||
rsync -avxHAX --progress /mnt/ /path/to/backup/nixbook-backup/
|
||||
```
|
||||
|
||||
### 2. Verify Configuration Changes
|
||||
The following files have been updated for btrfs:
|
||||
- `machines/nix-book/configuration.nix` - Added beesd service
|
||||
- `machines/nix-book/hardware-configuration.nix` - Changed fsType to btrfs with compression
|
||||
|
||||
## Migration Process
|
||||
|
||||
### Phase 1: Boot to Live Environment
|
||||
1. **Create NixOS live USB**:
|
||||
```bash
|
||||
# Download latest NixOS ISO
|
||||
# Flash to USB drive
|
||||
dd if=nixos-minimal-xx.xx-x86_64-linux.iso of=/dev/sdX bs=4M status=progress
|
||||
```
|
||||
|
||||
2. **Boot from live USB** and ensure you can access the encrypted drives
|
||||
|
||||
### Phase 2: Filesystem Conversion
|
||||
3. **Unlock LUKS volumes**:
|
||||
```bash
|
||||
cryptsetup luksOpen /dev/disk/by-uuid/4126fbd4-bd09-4ece-af0d-6fff414c21b3 luks-nixbook
|
||||
cryptsetup luksOpen /dev/disk/by-uuid/b614167b-9045-4234-a441-ac6f60a96d81 luks-nixbook2
|
||||
```
|
||||
|
||||
4. **Check filesystem before conversion**:
|
||||
```bash
|
||||
fsck.ext4 -f /dev/mapper/luks-nixbook
|
||||
```
|
||||
|
||||
5. **Convert ext4 to btrfs** (this preserves all data):
|
||||
```bash
|
||||
# Install btrfs-progs if not available
|
||||
nix-shell -p btrfs-progs
|
||||
|
||||
# Convert the filesystem (takes 15-45 minutes depending on data)
|
||||
btrfs-convert /dev/mapper/luks-nixbook
|
||||
|
||||
# Verify conversion succeeded
|
||||
mount /dev/mapper/luks-nixbook /mnt
|
||||
ls -la /mnt # Should show your normal filesystem
|
||||
btrfs filesystem show /mnt
|
||||
```
|
||||
|
||||
6. **Get new filesystem UUID** (may have changed):
|
||||
```bash
|
||||
blkid /dev/mapper/luks-nixbook
|
||||
# Note the new UUID if it changed
|
||||
```
|
||||
|
||||
### Phase 3: Configuration Update
|
||||
7. **Mount and chroot into system**:
|
||||
```bash
|
||||
mount -o compress=zstd,noatime /dev/mapper/luks-nixbook /mnt
|
||||
mount /dev/disk/by-uuid/7A0B-CF88 /mnt/boot
|
||||
nixos-enter --root /mnt
|
||||
```
|
||||
|
||||
8. **Update hardware-configuration.nix** if UUID changed:
|
||||
```bash
|
||||
# Edit /etc/nixos/hardware-configuration.nix if needed
|
||||
# Update the UUID in fileSystems."/" section
|
||||
```
|
||||
|
||||
9. **Rebuild system with btrfs configuration**:
|
||||
```bash
|
||||
cd /home/johno/nixos-configs
|
||||
nixos-rebuild switch --flake .#nix-book
|
||||
```
|
||||
|
||||
### Phase 4: Enable Compression and Deduplication
|
||||
10. **Reboot into new btrfs system**:
|
||||
```bash
|
||||
exit # Exit chroot
|
||||
umount -R /mnt
|
||||
reboot
|
||||
```
|
||||
|
||||
11. **Verify btrfs is working**:
|
||||
```bash
|
||||
mount | grep btrfs
|
||||
btrfs filesystem usage /
|
||||
```
|
||||
|
||||
12. **Enable and start beesd**:
|
||||
```bash
|
||||
systemctl status beesd-root
|
||||
systemctl start beesd-root
|
||||
systemctl enable beesd-root
|
||||
```
|
||||
|
||||
13. **Force compression on existing files** (optional but recommended):
|
||||
```bash
|
||||
# This will compress existing files with zstd
|
||||
btrfs filesystem defragment -r -czstd /
|
||||
```
|
||||
|
||||
## Post-Migration Verification
|
||||
|
||||
### Check System Health
|
||||
```bash
|
||||
# Verify btrfs health
|
||||
btrfs scrub start /
|
||||
btrfs scrub status /
|
||||
|
||||
# Check compression effectiveness
|
||||
compsize /
|
||||
|
||||
# Monitor beesd deduplication
|
||||
journalctl -u beesd-root -f
|
||||
|
||||
# Check filesystem usage
|
||||
btrfs filesystem usage /
|
||||
df -h /
|
||||
```
|
||||
|
||||
### Performance Monitoring
|
||||
```bash
|
||||
# Monitor beesd hash table
|
||||
ls -lh /.beeshash
|
||||
|
||||
# Check compression ratio over time
|
||||
compsize /home /nix /var
|
||||
```
|
||||
|
||||
## Expected Benefits
|
||||
|
||||
### Space Savings
|
||||
- **Compression**: 20-30% reduction in disk usage from zstd
|
||||
- **Deduplication**: Additional 10-20% savings on duplicate files
|
||||
- **Combined**: Potentially 30-40% total space savings
|
||||
|
||||
### Performance Impact
|
||||
- **Compression**: Minimal CPU overhead, often improves I/O performance
|
||||
- **Deduplication**: Background process, minimal impact during normal use
|
||||
- **Overall**: Should be neutral to positive performance impact
|
||||
|
||||
## Rollback Plan (Emergency)
|
||||
|
||||
If something goes wrong:
|
||||
|
||||
1. **Boot from live USB**
|
||||
2. **Restore from backup**:
|
||||
```bash
|
||||
cryptsetup luksOpen /dev/disk/by-uuid/4126fbd4-bd09-4ece-af0d-6fff414c21b3 luks-nixbook
|
||||
mkfs.ext4 /dev/mapper/luks-nixbook
|
||||
mount /dev/mapper/luks-nixbook /mnt
|
||||
rsync -avxHAX --progress /path/to/backup/nixbook-backup/ /mnt/
|
||||
```
|
||||
3. **Restore original hardware-configuration.nix** with ext4 settings
|
||||
4. **Rebuild and reboot**
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
**"Device busy" during conversion**:
|
||||
- Ensure no processes are accessing the filesystem
|
||||
- Check with `lsof` and `fuser`
|
||||
|
||||
**UUID changed after conversion**:
|
||||
- Update hardware-configuration.nix with new UUID
|
||||
- Regenerate initrd: `nixos-rebuild switch`
|
||||
|
||||
**Beesd service fails to start**:
|
||||
- Check disk space for hash table
|
||||
- Verify filesystem is btrfs: `mount | grep btrfs`
|
||||
- Check logs: `journalctl -u beesd-root`
|
||||
|
||||
**Boot issues after conversion**:
|
||||
- Boot from live USB
|
||||
- Check /boot partition is mounted correctly
|
||||
- Verify LUKS UUIDs match in configuration
|
||||
- Rebuild bootloader: `nixos-rebuild switch --install-bootloader`
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Regular Tasks
|
||||
```bash
|
||||
# Monthly scrub (checks for corruption)
|
||||
btrfs scrub start /
|
||||
|
||||
# Monitor compression effectiveness
|
||||
compsize /
|
||||
|
||||
# Check beesd deduplication status
|
||||
systemctl status beesd-root
|
||||
```
|
||||
|
||||
### Space Management
|
||||
```bash
|
||||
# Balance filesystem (defragments and optimizes)
|
||||
btrfs balance start -dusage=50 /
|
||||
|
||||
# Check for space issues
|
||||
btrfs filesystem usage /
|
||||
```
|
||||
|
||||
This migration preserves all your data while gaining the benefits of modern btrfs features including transparent compression and automatic deduplication.
|
||||
48
machines/nix-deck/configuration.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../roles/desktop/steamos.nix
|
||||
];
|
||||
|
||||
roles = {
|
||||
audio.enable = true;
|
||||
bluetooth.enable = true;
|
||||
desktop = {
|
||||
enable = true;
|
||||
wayland = true;
|
||||
gaming.enable = true;
|
||||
kde = true;
|
||||
steamos = {
|
||||
enable = true;
|
||||
autoStart = true;
|
||||
desktopSession = "plasma";
|
||||
};
|
||||
};
|
||||
remote-build.builders = [
|
||||
{
|
||||
hostName = "zix790prors.oglehome";
|
||||
maxJobs = 16;
|
||||
speedFactor = 4;
|
||||
}
|
||||
{
|
||||
hostName = "john-endesktop.oglehome";
|
||||
maxJobs = 1;
|
||||
speedFactor = 2;
|
||||
}
|
||||
];
|
||||
users = {
|
||||
enable = true;
|
||||
extraGroups = [ "video" ];
|
||||
};
|
||||
};
|
||||
|
||||
# Bootloader
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "nix-deck";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
system.stateVersion = "25.05";
|
||||
}
|
||||