feat(claude): seed curated CLAUDE.md files into ~/dev/ workspace

Adds the omnixy-pattern out-of-store-symlink wiring so consumers can
opt into Claude Code orientation without copying anything by hand.
Files live in lnbits-sensei (so they evolve via PR), symlinks point
back at the consumer's checkout (so edits take effect on the next
Claude session without a nixos-rebuild).

New files under files/:

- dev-CLAUDE.md — generic workspace orientation. Workspace layout,
  quick command set, pointers to docs/. Opt-in (clobbers an existing
  ~/dev/CLAUDE.md, so off by default).
- lnbits-CLAUDE.md — per-project orientation for the lnbits worktree
  subtree. Inline summary of the four most-stepped-on gotchas
  (settings precedence, Quasar UMD self-closing rule, auth-decorator
  distinctions, upstream PR target = `dev` not `main`) plus pointers
  to the docs/ for full reference.

New options under lnbits-sensei.devEnv:

- scaffoldPath — absolute path to the consumer's lnbits-sensei
  checkout. types.str (not types.path) intentionally: types.path
  would copy the file into the Nix store and defeat
  mkOutOfStoreSymlink. Required when any claude.* flag is on.
- claude.enable — seeds ~/dev/lnbits/CLAUDE.md.
- claude.workspaceOrientation — additionally seeds ~/dev/CLAUDE.md.

Wiring lives in home.nix (gated via `osConfig.lnbits-sensei.devEnv.*`)
rather than the dev-env NixOS module, since the file destinations are
under home-manager's purview and the home-manager scope is where
`mkOutOfStoreSymlink` is in scope.

`nix flake check` stays green — `optionalAttrs` is lazy, so
`scaffoldPath` isn't accessed when claude.{enable,workspaceOrientation}
are both false (their defaults).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-26 00:54:55 +02:00
commit 0a5713c704
5 changed files with 242 additions and 0 deletions

View file

@ -97,6 +97,21 @@ in
options.lnbits-sensei.devEnv = {
enable = mkEnableOption "lnbits-sensei dev-env tooling";
scaffoldPath = mkOption {
type = types.str;
description = ''
Absolute path to your lnbits-sensei checkout on this machine.
Used to source the seedable CLAUDE.md files (and, later, the
dev-env scripts) via `mkOutOfStoreSymlink` so edits in your
checkout take effect without a rebuild.
Required when any `claude.*` integration is enabled. Type is
`str` (not `path`) intentionally `path` would copy the file
into the Nix store and break the out-of-store-symlink semantics.
'';
example = "/home/alice/dev/lnbits-sensei";
};
root = mkOption {
type = types.str;
default = "/home/${config.lnbits-sensei.user or "user"}/dev";
@ -108,6 +123,23 @@ in
'';
};
claude = {
enable = mkEnableOption ''
Seed `~/dev/lnbits/CLAUDE.md` from
`''${scaffoldPath}/files/lnbits-CLAUDE.md` so Claude sessions
anywhere in the lnbits worktree subtree pick up project-specific
orientation (settings precedence, frontend rules, auth
decorators, )
'';
workspaceOrientation = mkEnableOption ''
Also seed `~/dev/CLAUDE.md` from
`''${scaffoldPath}/files/dev-CLAUDE.md`. Skip if you already
maintain a workspace-level CLAUDE.md this option clobbers
whatever is there
'';
};
projects = mkOption {
type = types.attrsOf projectType;
default = { };