Skip to content

Add NB2123 host and reorganize home modules into shared/darwin layers - #1

Merged
brutcha merged 4 commits into
mainfrom
feat/add-nb2123-host
Jul 2, 2026
Merged

Add NB2123 host and reorganize home modules into shared/darwin layers#1
brutcha merged 4 commits into
mainfrom
feat/add-nb2123-host

Conversation

@brutcha

@brutcha brutcha commented Jul 2, 2026

Copy link
Copy Markdown
Owner
  • Add NB2123 (work MacBook) - corp gateway env, cert bundle, npm/yarn registries, dev-shell sidecar for the NPA project, and codified macOS defaults (dock, finder, screensaver, symbolic hotkeys, .DS_Store off on network/USB)
  • Introduce ~/.config/dotfiles/private.nix for per-host identity and secrets (JWT, PAT, base URL, CA PEM). Flake reads it via --impure and passes as specialArg; template at hosts/NB2123/private.example.nix
  • Reorganize modules/home/ into a platform-generic default + darwin/ bundle. Hosts on macOS import a single path (modules/home/darwin). Darwin-only modules carry an isDarwin guard for defense in depth
  • Guard the corp-npa dev-shell sidecar on private.npa presence so enabling direnv on non-NPA hosts doesn't blow up
  • Add home modules: claude-code (settings.json jq-merge activation), git (global ignores, GCM, includeIf identities), rtk, zed, keepass, helium
  • Add pkgs: Ice, Emdash, Raycast, Zed (brew casks on macOS; nixpkgs paths for Linux where relevant)
  • Split git config layers: brutcha identity + GCM shared; corp CA path, ADO useHttpPath, and Creditas identity host/project scoped
  • Rewrite README + add hosts/NB2123/README.md
  • Fix sketchybar typos and clean up an obsolete keepass TODO

Summary by CodeRabbit

  • New Features
    • Added a new macOS workstation profile with host-scoped browser settings, security (KeePass + secret injection), and app configuration.
    • Added optional dev tools (Claude Code, Zed, Emdash, Ice, Raycast) plus per-project dev shells/sidecars.
    • Enabled corporate TLS trust bundling and automatic Helium preference/flag merging.
  • Documentation
    • Refreshed setup/runbooks with unified rebuild commands, updated directory guidance, and a clearer per-project workflow.
  • Bug Fixes
    • Improved macOS app re-registration after updates so managed apps are recognized.
  • Chores
    • Added cache validation before rebuilds and updated local ignore rules.

- Add NB2123 (work MacBook) - corp gateway env, cert bundle, npm/yarn
  registries, dev-shell sidecar for the NPA project, and codified macOS
  defaults (dock, finder, screensaver, symbolic hotkeys, .DS_Store off
  on network/USB)
- Introduce ~/.config/dotfiles/private.nix for per-host identity and
  secrets (JWT, PAT, base URL, CA PEM). Flake reads it via --impure and
  passes as specialArg; template at hosts/NB2123/private.example.nix
- Reorganize modules/home/ into a platform-generic default + darwin/
  bundle. Hosts on macOS import a single path (modules/home/darwin).
  Darwin-only modules carry an isDarwin guard for defense in depth
- Guard the corp-npa dev-shell sidecar on private.npa presence so
  enabling direnv on non-NPA hosts doesn't blow up
- Add home modules: claude-code (settings.json jq-merge activation),
  git (global ignores, GCM, includeIf identities), rtk, zed, keepass,
  helium
- Add pkgs: Ice, Emdash, Raycast, Zed (brew casks on macOS; nixpkgs
  paths for Linux where relevant)
- Split git config layers: brutcha identity + GCM shared; corp CA path,
  ADO useHttpPath, and Creditas identity host/project scoped
- Rewrite README + add hosts/NB2123/README.md
- Fix sketchybar typos and clean up an obsolete keepass TODO
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 68243fb1-a55e-4fb3-b94c-20709f9e70f8

📥 Commits

Reviewing files that changed from the base of the PR and between 82a7ff0 and 45de1a5.

📒 Files selected for processing (7)
  • README.md
  • hosts/NB2123/README.md
  • hosts/NB2123/home.nix
  • hosts/NB2123/private.example.nix
  • hosts/NB2123/registries.nix
  • modules/home/development/dev-shells/corp-npa.nix
  • scripts/check-cache.sh
✅ Files skipped from review due to trivial changes (2)
  • hosts/NB2123/private.example.nix
  • hosts/NB2123/README.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • scripts/check-cache.sh
  • README.md
  • hosts/NB2123/registries.nix
  • hosts/NB2123/home.nix

Walkthrough

This PR adds the NB2123 host, host-private certificate and registry wiring, opt-in Darwin/Home Manager modules, new development and package wiring, and updated documentation plus cache-check tooling.

Changes

NB2123 host and Darwin wiring

Layer / File(s) Summary
Flake and host wiring
flake.nix
Adds new flake inputs, disables legacy channels, threads private into Home Manager arguments, and adds the NB2123 Darwin configuration.
NB2123 host modules and secrets
hosts/NB2123/*.nix
Adds the NB2123 system module, cert bundle activation, private template, registry generation, Home Manager setup, and host README runbook.
Darwin Home Manager core and app modules
modules/home/default.nix, modules/home/darwin/*
Adds Darwin Home Manager bundling, opt-in app modules, Helium/KeePassXC activation, and window-manager toggles and registration hooks.

Development modules and package wiring

Layer / File(s) Summary
Development modules and sidecars
modules/home/development/*, modules/home/development/dev-shells/*
Refactors development options into opt-in modules, adds Claude Code, Git, rtk, Zed, Neovim provider changes, and generates direnv sidecar shells.
Package overlay and app options
modules/darwin/apps/system.nix, modules/shared/apps/development.nix, pkgs/*
Adds the Ice option, shared development app options, and package overlay entries for Raycast, Emdash, and Zed Editor.

Docs, scripts, and cosmetic updates

Layer / File(s) Summary
Documentation, cache check, and comment fixes
README.md, scripts/check-cache.sh, .gitignore, config/sketchybar/items/*.lua
Rewrites the main README, adds cache-check tooling, ignores local override files, and fixes comment typos in SketchyBar widget files.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant flake.nix
  participant NB2123
  participant HomeManager
  participant private.nix
  flake.nix->>private.nix: import host private values
  flake.nix->>NB2123: define darwinConfigurations.NB2123
  NB2123->>HomeManager: pass private via specialArgs
  HomeManager->>HomeManager: build host-scoped config
Loading
sequenceDiagram
  participant HomeManager
  participant HeliumModule
  participant KeepassModule
  participant FileSystem
  HomeManager->>HeliumModule: enable Helium
  HeliumModule->>FileSystem: merge prefsOverrides and flagOverrides
  HomeManager->>KeepassModule: enable KeePassXC integration
  KeepassModule->>FileSystem: write browser settings and native messaging manifest
  HomeManager->>FileSystem: register .app bundles with LaunchServices
Loading
sequenceDiagram
  participant DevShellModule
  participant CorpNpaModule
  participant ProjectDir
  participant GitConfig
  DevShellModule->>CorpNpaModule: import when private.npa exists
  CorpNpaModule->>ProjectDir: write flake.nix, .envrc, .emdash.json
  CorpNpaModule->>ProjectDir: symlink sidecar files into ~/git/<projectId>
  CorpNpaModule->>GitConfig: apply per-project identity include
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: adding the NB2123 host and restructuring home modules into shared and Darwin-specific layers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-nb2123-host

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (2)
modules/home/development/rtk.nix (1)

18-22: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Ordering guarantee only holds via the shared default; not enforced.

rtk.enable defaults to claude-code.enable, and rtkInit runs entryAfter [ "claudeCodeSettings" ... ]. If a user ever sets rtk.enable = true while claude-code.enable = false (default no longer applies), the claudeCodeSettings activation entry won't exist, silently dropping the ordering guarantee this comment block relies on — rtk init -g --auto-patch could then run against a nonexistent/still-symlinked ~/.claude/settings.json.

An assertions entry (e.g. cfg.enable -> config.home.apps.development.claude-code.enable) would make this dependency explicit instead of implicit-via-default.

♻️ Proposed assertion
   config = lib.mkIf cfg.enable {
+    assertions = [{
+      assertion = config.home.apps.development.claude-code.enable;
+      message = "home.apps.development.rtk requires claude-code.enable (claudeCodeSettings must run first).";
+    }];
     home.packages = [ pkgs.rtk ];

Also applies to: 31-35

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/home/development/rtk.nix` around lines 18 - 22, The ordering
dependency between rtk and claude-code is only implied by the shared default, so
make it explicit in the rtk module. Add an assertion in the rtk configuration
logic that rejects cfg.enable when
config.home.apps.development.claude-code.enable is false, and keep the existing
entryAfter dependency in rtkInit tied to claudeCodeSettings. Use the existing
symbols rtk.enable, rtkInit, and claudeCodeSettings so the dependency remains
enforced even when defaults are overridden.
modules/home/darwin/window-manager/sketchybar.nix (1)

17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Indentation is inconsistent within the programs.sketchybar block.

sketchybar = {, enable = true;, and config = { are not indented relative to programs = { the way the rest of the file's style suggests (compare to xdg.configFile block below). Minor readability nit only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/home/darwin/window-manager/sketchybar.nix` around lines 17 - 22, The
`programs.sketchybar` block has inconsistent indentation relative to `programs =
{`, so adjust the alignment of `sketchybar = {`, `enable = true;`, and `config =
{` to match the surrounding Nix style used elsewhere in the file, especially the
`xdg.configFile` block.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@flake.nix`:
- Around line 120-124: The Home Manager wiring in flake.nix is forwarding
private.nix through home-manager.extraSpecialArgs, which can expose long-lived
secrets during Nix evaluation. Update the private argument passed via
extraSpecialArgs so it contains only non-secret metadata, and move secret access
out of evaluation in the downstream NB2123 config that reads
private.secrets.anthropicJwt. Load the token at runtime from a secure source
such as Keychain, sops/agenix, or a 0600 file outside the store, and apply the
same change wherever private is passed through the affected call sites.

In `@hosts/NB2123/home.nix`:
- Around line 26-38: Move the secret-backed env values out of the Nix-evaluated
cfg.env assignment in the claude-code block so they are not embedded by
builtins.toJSON into settingsOverridesJson. Replace direct uses of
private.secrets.anthropicBaseUrl and private.secrets.anthropicJwt with runtime
secret injection or activation-time sourcing, and apply the same pattern to the
private.secrets.azureDevopsPat usage in registries.nix. Keep the claude-code and
registries settings structure intact while ensuring no secret values are
serialized into the store-backed activation script.

In `@hosts/NB2123/registries.nix`:
- Around line 17-21: The Yarn registry config in registries.nix is embedding
private.secrets.azureDevopsPat into the generated .yarnrc.yml text, which places
the Azure DevOps PAT in the Nix store. Update the logic around the npmRegistries
/ home.file.".yarnrc.yml".text generation to source the token from a secrets
manager or other runtime secret mechanism instead of interpolating it directly;
if keeping it in plaintext is intentional, add an explicit comment/documentation
note near the private.secrets.azureDevopsPat usage and the registries config to
make that tradeoff clear.

In `@modules/home/development/claude-code.nix`:
- Around line 12-20: `settingsOverridesJson` is embedding all of `cfg.env` into
a store-backed JSON blob, which can expose secrets like auth tokens. Update
`claudeCodeSettings` so `cfg.env` only carries non-sensitive values, and load
any secret at activation/runtime from a private source instead of via
`builtins.toJSON`; use the existing
`settingsOverridesJson`/`home.activation.claudeCodeSettings` path to locate the
affected flow.

In `@modules/home/development/dev-shells/corp-npa.nix`:
- Around line 18-23: The shellHook in corp-npa.nix is disabling Node TLS
verification for the entire dev shell, which is too broad. Update the shellHook
so NODE_TLS_REJECT_UNAUTHORIZED=0 is not exported globally; instead, scope the
bypass to only the specific corp NPA commands or hosts that still need it, and
keep caExport/NODE_EXTRA_CA_CERTS as the default for all other Node tooling.
- Around line 70-76: The symlink check in the dev-shell setup loop is using a
test that follows links, so a dangling symlink is treated as missing and the
subsequent ln -s fails on re-activation. Update the existence check in the
corp-npa.nix shell snippet to treat any existing path, including broken
symlinks, as present before creating links for .emdash.json and .envrc, so
rerunning home-manager switch skips stale links instead of trying to recreate
them.

In `@README.md`:
- Around line 27-48: The README tree block is an unlabeled fenced code block
that markdownlint flags; update the fence around the directory listing to use a
neutral language such as text. Locate the documentation snippet in README.md and
change only the opening fence for that tree diagram so the markdown lint passes
while keeping the content unchanged.

In `@scripts/check-cache.sh`:
- Around line 45-48: The package lookup in the nix eval expression is using an
unquoted attribute access via .$pkg, which fails for hyphenated package names.
Update the lookup in the cache probe to use a quoted/dynamic attribute access
form in the expression, such as builtins.getAttr or pkgs."$pkg", so the script
handles watched packages like git-credential-manager, zed-editor, and dotnet-sdk
correctly.

---

Nitpick comments:
In `@modules/home/darwin/window-manager/sketchybar.nix`:
- Around line 17-22: The `programs.sketchybar` block has inconsistent
indentation relative to `programs = {`, so adjust the alignment of `sketchybar =
{`, `enable = true;`, and `config = {` to match the surrounding Nix style used
elsewhere in the file, especially the `xdg.configFile` block.

In `@modules/home/development/rtk.nix`:
- Around line 18-22: The ordering dependency between rtk and claude-code is only
implied by the shared default, so make it explicit in the rtk module. Add an
assertion in the rtk configuration logic that rejects cfg.enable when
config.home.apps.development.claude-code.enable is false, and keep the existing
entryAfter dependency in rtkInit tied to claudeCodeSettings. Use the existing
symbols rtk.enable, rtkInit, and claudeCodeSettings so the dependency remains
enforced even when defaults are overridden.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dcfd1b50-311e-4927-ac1e-60ceaf2eb6b2

📥 Commits

Reviewing files that changed from the base of the PR and between 01584ba and dadf673.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (43)
  • .gitignore
  • README.md
  • config/sketchybar/items/network.lua
  • config/sketchybar/items/ram.lua
  • flake.nix
  • hosts/NB2123/README.md
  • hosts/NB2123/cert-bundle.nix
  • hosts/NB2123/default.nix
  • hosts/NB2123/home.nix
  • hosts/NB2123/private.example.nix
  • hosts/NB2123/registries.nix
  • hosts/makima/home.nix
  • modules/darwin/apps/system.nix
  • modules/home/darwin/default.nix
  • modules/home/darwin/development.nix
  • modules/home/darwin/internet/default.nix
  • modules/home/darwin/internet/helium.nix
  • modules/home/darwin/security/default.nix
  • modules/home/darwin/security/keepass.nix
  • modules/home/darwin/window-manager/aerospace.nix
  • modules/home/darwin/window-manager/default.nix
  • modules/home/darwin/window-manager/jankyborders.nix
  • modules/home/darwin/window-manager/sketchybar.nix
  • modules/home/default.nix
  • modules/home/development/claude-code.nix
  • modules/home/development/darwin.nix
  • modules/home/development/default.nix
  • modules/home/development/dev-shells/corp-npa.nix
  • modules/home/development/dev-shells/default.nix
  • modules/home/development/dev-shells/templates/node-project.flake.nix
  • modules/home/development/git.nix
  • modules/home/development/nvim.nix
  • modules/home/development/rtk.nix
  • modules/home/development/zed.nix
  • modules/home/internet/default.nix
  • modules/home/internet/zen.nix
  • modules/home/window-manager/jankyborders.nix
  • modules/shared/apps/development.nix
  • pkgs/default.nix
  • pkgs/emdash/default.nix
  • pkgs/raycast/default.nix
  • pkgs/zed-editor/default.nix
  • scripts/check-cache.sh
💤 Files with no reviewable changes (4)
  • modules/home/development/darwin.nix
  • modules/home/window-manager/jankyborders.nix
  • modules/home/internet/zen.nix
  • modules/home/internet/default.nix

Comment thread flake.nix
Comment thread hosts/NB2123/home.nix
Comment thread hosts/NB2123/registries.nix Outdated
Comment thread modules/home/development/claude-code.nix
Comment thread modules/home/development/dev-shells/corp-npa.nix Outdated
Comment thread modules/home/development/dev-shells/corp-npa.nix
Comment thread README.md Outdated
Comment thread scripts/check-cache.sh Outdated
Secrets previously imported at eval time from private.nix (anthropicJwt,
anthropicBaseUrl, azureDevopsPat, corpCaBundlePem) leaked into the
world-readable /nix/store via activation scripts and pkgs.writeText. Now
they live only in the KeePassXC vault under corp/*, extracted at
activation time using the master password cached in macOS Keychain
(service kdbx-master, account du234).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hosts/NB2123/cert-bundle.nix`:
- Around line 33-43: The cert-bundle update logic currently only logs warnings
when corp CA extraction is skipped, which can leave /etc/nix/cert-bundle.pem
absent. Update the cert-bundle.nix activation flow around the vault-missing and
extractCa failure branches to always seed a fallback bundle at
/etc/nix/cert-bundle.pem, using the system cert bundle already referenced in the
successful path, so nix.settings.ssl-cert-file always points to an existing
file.

In `@hosts/NB2123/home.nix`:
- Around line 69-78: The activation snippet currently exits early in the
missing-vault and missing-Keychain branches, which can abort the rest of the
Home Manager activation sequence. Refactor the secret-extraction logic in the
guarded block so it uses if/else handling instead of calling exit 0, keeping
only the corp-secrets-specific work conditional while allowing the surrounding
activation script to continue normally.
- Around line 64-66: The KDBX master password bootstrap examples currently use
the broad Keychain access flag, which should be avoided. Update the bootstrap
guidance in the related Keychain helper examples to remove the permissive access
and either leave the item prompt-protected or restrict access to only the
specific helper binaries that need it. Make sure both example lines in the
affected comment block are updated consistently so users do not copy the unsafe
option.

In `@hosts/NB2123/private.example.nix`:
- Around line 2-4: The host metadata comment points to the wrong activation
hook; update the reference so it matches the actual KeePass extraction hook used
by this host. In the private.example.nix header, replace the mention of
home.apps.security.keepass.secrets with the real symbol
home.activation.keepassSecretsExtract so the template and implementation stay
aligned.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ddd1c5b8-9aa2-4b00-ad1c-5bf2d3f8ed22

📥 Commits

Reviewing files that changed from the base of the PR and between dadf673 and 82a7ff0.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • hosts/NB2123/README.md
  • hosts/NB2123/cert-bundle.nix
  • hosts/NB2123/home.nix
  • hosts/NB2123/private.example.nix
  • hosts/NB2123/registries.nix
  • modules/home/development/rtk.nix
✅ Files skipped from review due to trivial changes (1)
  • hosts/NB2123/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • modules/home/development/rtk.nix

Comment thread hosts/NB2123/cert-bundle.nix
Comment thread hosts/NB2123/home.nix Outdated
Comment thread hosts/NB2123/home.nix
Comment thread hosts/NB2123/private.example.nix Outdated
brutcha added 2 commits July 2, 2026 22:12
- corp-npa.nix: drop NODE_TLS_REJECT_UNAUTHORIZED=0 — verified with
`NODE_TLS_REJECT_UNAUTHORIZED=1 yarn install --frozen-lockfile` in the
NPA checkout, which completed without cert errors. The corp CA from the
KDBX-extracted /etc/nix/cert-bundle.pem via NODE_EXTRA_CA_CERTS is now
sufficient on its own.
- corp-npa.nix: guard sidecar symlink creation against dangling links by
also testing -L, not just -e (which follows into non-existence).
- README.md: label the directory-tree fenced block as `text` for MD040.
- scripts/check-cache.sh: quote the dynamic attribute access (`."$pkg"`)
so hyphenated watchlist entries (git-credential-manager, zed-editor,
dotnet-sdk) resolve instead of silently failing eval.
- corp-npa.nix: drop NODE_TLS_REJECT_UNAUTHORIZED=0
- corp-npa.nix: guard sidecar symlink creation against dangling links
- home.nix: replace `exit 0` in home.activation blocks with if/else
- home.nix + README + memory: tighten Keychain bootstrap
- private.example.nix: update stale hook reference
- README.md: label the directory-tree fenced block
- scripts/check-cache.sh: quote the dynamic attribute access
@brutcha

brutcha commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@brutcha
brutcha merged commit b4f89a1 into main Jul 2, 2026
1 check passed
@brutcha
brutcha deleted the feat/add-nb2123-host branch July 3, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant