feat(dev-env): backport matured dev-env implementation from /etc/nixos

Replace the stub dev-env with the real, working implementation that grew
in the reference machine config — de-identified for the public scaffold.

Nix layer:
- options.nix: full project schema (url/upstream/fork/category/
  worktreeRoot/worktrees{branch,path,remote}/isClone/deployFlakeInput),
  deploy.targets, github.forkUser, writeDirenvHints. Drops the
  forgejo-URL block + deploy-flake auto-derivation (incoherent in a
  scaffold that uses explicit per-project urls).
- lib.nix: mkProject + worktreePath/bareRepoPath/projectRemotes,
  generalized to the explicit-url model (origin falls back to upstream).
- config.nix: renders /etc/dev-env/{config.sh,projects.json,
  tmux-sessions.json}, installs helpers via writeShellScriptBin, loads
  shell functions into interactive shells, wires the git pre-commit hook.

Scripts (config-driven, read /etc/dev-env at runtime):
- bootstrap.sh, nav.sh, worktree.sh, pr-helpers.sh, rebase.sh,
  status.sh, deploy.sh, regtest.sh, tmux-launch.sh.
- Stripped aiolabs/forgejo/bitspire/lamassu/webapp hardcoding; the
  github-fork remote is renamed 'fork' to match git.remotes vocabulary.
- Removes the dev.sh stub (the matured impl uses discrete commands +
  shell functions, not a unified 'dev' CLI).

presets/example.nix: a worked, generic project list replacing the
identity-specific aiolabs preset. tests/smoke.nix + flake checks
exercise the schema; 'nix flake check' is green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-06-15 21:18:49 +02:00
commit e38d313db2
17 changed files with 2925 additions and 147 deletions

View file

@ -49,8 +49,23 @@
# `settings` (single source of truth — user, host, identity,
# remote topology) is threaded into every NixOS module and into
# the home-manager module set, so neither has to re-import it.
# dev-env schema smoke test — a minimal nixosSystem that imports
# only core.nix + the dev-env module and exercises the option
# surface. `nix flake check` builds the rendered config artifacts,
# which forces full module evaluation (catching schema breakage)
# without building a whole system.
smoke = import ./modules/dev-env/tests/smoke.nix {
inherit nixpkgs home-manager;
};
in
{
checks.${system} = {
dev-env-projects-json = smoke.config.environment.etc."dev-env/projects.json".source;
dev-env-config-sh = smoke.config.environment.etc."dev-env/config.sh".source;
dev-env-tmux-sessions = smoke.config.environment.etc."dev-env/tmux-sessions.json".source;
};
nixosConfigurations.${settings.hostName} = nixpkgs.lib.nixosSystem {
inherit system;