Skip to content

Conversation

@connerohnesorge
Copy link
Owner

@connerohnesorge connerohnesorge commented Jan 11, 2026

Summary

  • Add per-host username option allowing different usernames per machine
  • Create work machine host config (CB14957.local) with username cohnesor
  • Update all modules to use dynamic username from myconfig.constants.username
  • Update standalone home-manager configs to accept username as argument

Changes

  • modules/config/hosts.nix - Added username option with default
  • modules/config/constants.nix - Username derives from host config
  • modules/config/user.nix - Fixed hardcoded usernames
  • modules/features/engineer.nix - Dynamic NordVPN users and nh flake path
  • hosts/mac-nix/default.nix - Uses dynamic username pattern
  • hosts/CB14957.local/default.nix - New work machine config
  • .config/home-manager/* - Updated to support multiple users

Usage

# Personal machines (use default username)
darwin-rebuild switch --flake .#Conners-MacBook-Air

# Work machine
darwin-rebuild switch --flake .#CB14957.local

Test plan

  • Verify nix flake check passes
  • Test rebuild on personal machine
  • Test rebuild on work machine

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added browser integration with selectable extensions and a new browser input for home configurations.
    • Introduced a firefox-addons input and applied its overlay across platforms.
  • Chores

    • Extended system configuration support for additional macOS and Linux hosts.
    • Made user/home settings configurable per-host (dynamic usernames and platform-specific home paths).
    • Centralized and parameterized user-related options for flexible multi-machine deployments.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add per-host username option in hosts.nix with default "connerohnesorge"
- Make constants.nix derive username from host configuration
- Update user.nix to use dynamic username in Darwin nix settings
- Update engineer.nix to use dynamic username for NordVPN and nh flake path
- Update mac-nix host to use dynamic username pattern
- Add CB14957.local host configuration for work machine (username: cohnesor)
- Update standalone home-manager configs to accept username as argument

This allows the same dotfiles to work across personal machines (connerohnesorge)
and work machines (cohnesor) by simply setting the username in host config.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

Walkthrough

Make host usernames configurable instead of hardcoded: introduced a username option, threaded it through home-manager entries, host defaults, and modules, and added new per-host/home-manager configurations that use the dynamic username value.

Changes

Cohort / File(s) Summary
Home-manager flake & entries
.config/home-manager/flake.nix
Added multiple public home-manager configurations (macOS and Linux) with per-entry extraSpecialArgs.username; updated an existing macOS entry and shortened the flake description.
Home-manager modules
.config/home-manager/home-darwin.nix, .config/home-manager/home.nix
Added username parameter (with default) to module signatures; replaced hardcoded username and homeDirectory values with inherit username and interpolated /Users/${username} or /home/${username}.
Host definitions
hosts/CB14957.local/default.nix, hosts/mac-nix/default.nix
Added new host config CB14957.local; made darwin block accept myconfig; replaced hardcoded primaryUser/user keys and home paths with myconfig.constants.username.
Config constants & host schema
modules/config/constants.nix, modules/config/hosts.nix
Removed readOnly wrapper from constants.username; added hosts.username option and homeManagerUser that defaults to config.username; introduced per-host derivation to set constants.username from host config.
User & feature modules
modules/config/user.nix, modules/features/engineer.nix
Replaced hardcoded username occurrences with variable/interpolated forms in trusted/allowed-users and service/user lists; parameterized nixos.always/nixos.ifEnabled with { myconfig, ... } and derived paths from myconfig.constants.username.
Inputs, overlays, and home imports
flake.nix, modules/config/home.nix, modules/config/rices.nix
Expanded/added structured inputs (zen-browser, firefox-addons), updated module signatures to accept inputs, added inputs.zen-browser to home.always.imports, and applied firefox-addons overlay to nixpkgs including Darwin.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 primary change: adding support for multiple users across different machines with per-host username configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/multi-user-support

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @hosts/CB14957.local/default.nix:
- Around line 1-112: The username is hardcoded as "cohnesor" in the host
definition (symbol: username = "cohnesor") which breaks multi-user deployments;
replace that literal with the constant reference used elsewhere
(myconfig.constants.username) so the host uses the centralized host/constants
value, and update any remaining hardcoded paths and settings (e.g., home paths,
homeManagerUser, .zshrc entries, and .config/home-manager/flake.nix username
fields referenced in the review) to derive from the same
myconfig.constants.username symbol rather than string literals to ensure
consistency across hosts.
🧹 Nitpick comments (5)
modules/config/constants.nix (2)

18-28: Docs say “read-only constants”, but constants.username is no longer read-only.

Either update the header comments (Line 3-14) to call out the host-derived exception, or re-introduce a read-only pattern for username (while still sourcing from myconfig.host.username) to keep constants.* truly immutable. Based on coding guidelines / learnings, modules/config/constants.nix is intended for read-only constants.


30-33: Good host→constants wiring; consider making precedence explicit.

If the intent is “host.username is the source of truth”, consider using a stronger precedence (or an assertion) so constants.username can’t silently drift due to another module assignment.

modules/config/hosts.nix (1)

35-37: Nice addition: per-host username option.

One guardrail to consider: avoid (or assert against) host configs setting host.username from myconfig.constants.username, since constants are now derived from host (easy to create recursion).

modules/config/user.nix (1)

14-40: Darwin Nix settings correctly use the dynamic username.

Optional for consistency: mirror the same username binding usage in the NixOS trusted-users / allowed-users lists (instead of re-interpolating myconfig.constants.username).

hosts/CB14957.local/default.nix (1)

53-112: Reduce duplication: bind username = myconfig.constants.username once in the darwin block.

This will make future edits (e.g., home path, primaryUser, users entry) less error-prone.

Proposed refactor
-    darwin = {myconfig, ...}: {
+    darwin = {myconfig, ...}: let
+      username = myconfig.constants.username;
+    in {
@@
-      system = {
+      system = {
         stateVersion = 5;
-        primaryUser = myconfig.constants.username;
+        primaryUser = username;
@@
-      users.users.${myconfig.constants.username} = {
-        home = "/Users/${myconfig.constants.username}";
+      users.users.${username} = {
+        home = "/Users/${username}";
       };
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0db1bcd and d63fddd.

📒 Files selected for processing (9)
  • .config/home-manager/flake.nix
  • .config/home-manager/home-darwin.nix
  • .config/home-manager/home.nix
  • hosts/CB14957.local/default.nix
  • hosts/mac-nix/default.nix
  • modules/config/constants.nix
  • modules/config/hosts.nix
  • modules/config/user.nix
  • modules/features/engineer.nix
🧰 Additional context used
📓 Path-based instructions (8)
modules/config/constants.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use modules/config/constants.nix for read-only user constants (username, email, etc.)

In modules/config/constants.nix, define read-only user constants such as username and email

Files:

  • modules/config/constants.nix
**/*.{nix,rs,py}

📄 CodeRabbit inference engine (GEMINI.md)

Use nix fmt to format code using treefmt (alejandra for Nix, rustfmt for Rust, black for Python)

Files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • modules/config/user.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
**/*.nix

📄 CodeRabbit inference engine (AGENTS.md)

**/*.nix: Use alejandra formatting for Nix files
Prefer let...in blocks in Nix code
Use kebab-case for Nix attributes

Files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • modules/config/user.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
modules/**/*.nix

📄 CodeRabbit inference engine (AGENTS.md)

modules/**/*.nix: Use delib.module pattern for Nix modules
Use platform-specific sections: nixos.ifEnabled, darwin.ifEnabled, home.ifEnabled for multi-platform support

Files:

  • modules/config/constants.nix
  • modules/config/hosts.nix
  • modules/config/user.nix
  • modules/features/engineer.nix
**/*.{py,nix}

📄 CodeRabbit inference engine (AGENTS.md)

Use snake_case for file and function names

Files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • modules/config/user.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
hosts/**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

hosts/**/*.nix: Use the delib.host pattern with type classification (desktop/laptop/server) for host configurations
Enable features in host configurations using myconfig.features.featureName = true syntax

In Nix host configuration files, use the delib.host pattern with type classification (desktop/laptop/server) and enable features through myconfig.features.*

Files:

  • hosts/mac-nix/default.nix
  • hosts/CB14957.local/default.nix
modules/config/hosts.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use modules/config/hosts.nix for host type definitions and feature mapping system

In modules/config/hosts.nix, define host type definitions and feature mapping system

Files:

  • modules/config/hosts.nix
modules/features/**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

modules/features/**/*.nix: Use the delib.module pattern with singleEnableOption false for feature modules in modules/features/
Define platform-specific configuration in separate sections using nixos.ifEnabled, darwin.ifEnabled, and home.ifEnabled for feature modules

In Nix module files, use the delib.module pattern with singleEnableOption false for feature modules with platform-specific sections: nixos.ifEnabled, darwin.ifEnabled, home.ifEnabled

Files:

  • modules/features/engineer.nix
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/constants.nix : Use `modules/config/constants.nix` for read-only user constants (username, email, etc.)
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/constants.nix : In `modules/config/constants.nix`, define read-only user constants such as username and email
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/args.nix : In `modules/config/args.nix`, define shared arguments between nixos and home-manager configurations
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/args.nix : Use `modules/config/args.nix` for shared arguments between nixos and home-manager configurations
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to hosts/**/*.nix : Enable features in host configurations using `myconfig.features.featureName = true` syntax
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to hosts/**/*.nix : In Nix host configuration files, use the `delib.host` pattern with type classification (desktop/laptop/server) and enable features through `myconfig.features.*`
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/args.nix : Use `modules/config/args.nix` for shared arguments between nixos and home-manager configurations

Applied to files:

  • .config/home-manager/home.nix
  • .config/home-manager/home-darwin.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/args.nix : In `modules/config/args.nix`, define shared arguments between nixos and home-manager configurations

Applied to files:

  • .config/home-manager/home.nix
  • modules/config/constants.nix
  • .config/home-manager/home-darwin.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/constants.nix : In `modules/config/constants.nix`, define read-only user constants such as username and email

Applied to files:

  • .config/home-manager/home.nix
  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • .config/home-manager/home-darwin.nix
  • modules/config/user.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/constants.nix : Use `modules/config/constants.nix` for read-only user constants (username, email, etc.)

Applied to files:

  • .config/home-manager/home.nix
  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • .config/home-manager/home-darwin.nix
  • modules/config/user.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to hosts/**/*.nix : In Nix host configuration files, use the `delib.host` pattern with type classification (desktop/laptop/server) and enable features through `myconfig.features.*`

Applied to files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to hosts/**/*.nix : Enable features in host configurations using `myconfig.features.featureName = true` syntax

Applied to files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/hosts.nix : In `modules/config/hosts.nix`, define host type definitions and feature mapping system

Applied to files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • hosts/CB14957.local/default.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/hosts.nix : Use `modules/config/hosts.nix` for host type definitions and feature mapping system

Applied to files:

  • modules/config/constants.nix
  • hosts/mac-nix/default.nix
  • modules/config/hosts.nix
  • hosts/CB14957.local/default.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/features/**/*.nix : Define platform-specific configuration in separate sections using `nixos.ifEnabled`, `darwin.ifEnabled`, and `home.ifEnabled` for feature modules

Applied to files:

  • hosts/mac-nix/default.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: When creating new feature modules in Nix, consider both nixos and darwin platforms and define platform-specific configuration in separate conditional sections

Applied to files:

  • hosts/mac-nix/default.nix
  • hosts/CB14957.local/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:25:42.835Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T14:25:42.835Z
Learning: Applies to modules/**/*.nix : Use platform-specific sections: `nixos.ifEnabled`, `darwin.ifEnabled`, `home.ifEnabled` for multi-platform support

Applied to files:

  • hosts/mac-nix/default.nix
  • modules/features/engineer.nix
  • .config/home-manager/flake.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to hosts/**/*.nix : Use the `delib.host` pattern with type classification (desktop/laptop/server) for host configurations

Applied to files:

  • hosts/CB14957.local/default.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/programs/*/default.nix : In custom program modules, create a directory in `modules/programs/` with source code and `default.nix`, define the package derivation with cross-platform support, and export using `delib.module` pattern

Applied to files:

  • hosts/CB14957.local/default.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/features/**/*.nix : In Nix module files, use the `delib.module` pattern with `singleEnableOption false` for feature modules with platform-specific sections: `nixos.ifEnabled`, `darwin.ifEnabled`, `home.ifEnabled`

Applied to files:

  • modules/features/engineer.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/features/**/*.nix : Use the `delib.module` pattern with `singleEnableOption false` for feature modules in `modules/features/`

Applied to files:

  • modules/features/engineer.nix
📚 Learning: 2025-11-28T14:25:42.835Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T14:25:42.835Z
Learning: Applies to modules/**/*.nix : Use `delib.module` pattern for Nix modules

Applied to files:

  • modules/features/engineer.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Validate Templates (macos-aarch64)
  • GitHub Check: Validate Templates (linux-x86_64)
🔇 Additional comments (10)
.config/home-manager/home.nix (1)

1-17: Good: username parameterization and derived homeDirectory.

This matches the multi-user goal and keeps a sensible default.

.config/home-manager/home-darwin.nix (1)

1-16: Good: macOS username parameterization and /Users/${username}.

Looks consistent with the Linux Home Manager module approach.

hosts/CB14957.local/default.nix (1)

11-33: Host-level username = "cohnesor" is the right knob for work/personal split.

This is exactly the kind of per-host override the rest of the PR is designed to consume.

hosts/mac-nix/default.nix (1)

49-106: LGTM: mac-nix now derives primaryUser and user home from myconfig.constants.username.

This aligns host config with the new per-host username pipeline.

modules/features/engineer.nix (3)

12-23: LGTM! Dynamic username correctly integrated into NordVPN configuration.

The conversion to a function pattern correctly enables per-host username resolution, and the NordVPN service is properly configured to grant access to the dynamic user.

Based on learnings, this aligns with the established pattern of using myconfig.constants.username for user constants.


27-27: LGTM! Consistent function pattern for dynamic configuration.

Converting nixos.ifEnabled to a function accepting myconfig is consistent with the nixos.always pattern and enables dynamic username resolution throughout the module.


204-204: LGTM! Dynamic flake path correctly implements per-user configuration.

The string interpolation correctly constructs the home directory path using the dynamic username, enabling different users to have their dotfiles in their respective home directories.

.config/home-manager/flake.nix (3)

2-2: LGTM! Description generalized for multi-user support.

The simplified description correctly reflects that this flake now supports multiple users rather than being specific to one user.


20-36: LGTM! macOS configurations correctly implement multi-user support.

Both personal and work macOS configurations properly use extraSpecialArgs to pass the username to the shared home-darwin.nix module, enabling per-user customization while maintaining a single module definition.


38-56: LGTM! Linux configurations correctly mirror macOS multi-user pattern.

Both Linux configurations properly implement the same extraSpecialArgs pattern as the macOS configs, enabling consistent multi-user support across platforms. The shared module approach (./home.nix) with parameterized usernames promotes maintainability.

Comment on lines +1 to +112
{
delib,
inputs,
pkgs,
config,
lib,
...
}: let
system = "aarch64-darwin";
in
delib.host {
name = "CB14957.local";

# Work machine username
username = "cohnesor";

rice = "empty";
type = "laptop";

home.home.stateVersion = "24.11";
homeManagerSystem = system;

myconfig = {
features = {
engineer.enable = true;
};
programs = {
dx.enable = true;
catls.enable = true;
convert_img.enable = true;
};
};

nixos = {
imports = [
inputs.determinate.nixosModules.default
];
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnsupportedSystem = true;
system.stateVersion = "24.11";

# Minimal file system configuration to prevent assertion failures
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};

boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
};

darwin = {myconfig, ...}: {
imports = [
# inputs.determinate.darwinModules.default
];

nixpkgs = {
hostPlatform = system;
config.allowUnfree = true;
};
nix.enable = false;
programs = {
direnv = {
enable = true;
nix-direnv = {
enable = true;
package = pkgs.nix-direnv;
};
};
ssh = {
extraConfig = ''
SetEnv TERM=xterm-256color
'';
};
};
system = {
stateVersion = 5;
primaryUser = myconfig.constants.username;
defaults = {
dock.autohide = true;

trackpad = {
Clicking = true;
TrackpadThreeFingerDrag = true;
Dragging = true;
};
};
};

environment = {
systemPackages = [
# Macos Only
pkgs.aerospace
pkgs.raycast
pkgs.xcodes
# Shared
];
shells = [pkgs.zsh];

pathsToLink = ["/share/qemu"];
etc."containers/containers.conf.d/99-gvproxy-path.conf".text = ''
[engine]
helper_binaries_dir = ["${pkgs.gvproxy}/bin"]
'';
};
users.users.${myconfig.constants.username} = {
home = "/Users/${myconfig.constants.username}";
};

security.pam.services.sudo_local.touchIdAuth = true;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Hardcoded username/path checks (tune allowlist as needed)
echo "=== Checking for hardcoded usernames/paths ==="
rg -n --hidden -S -g '!.git/**' \
  'connerohnesorge|/Users/connerohnesorge|/home/connerohnesorge|users\.users\.connerohnesorge' || echo "No matches found"

echo ""
echo "=== Checking for any hardcoded 'cohnesor' references ==="
rg -n --hidden -S -g '!.git/**' \
  'cohnesor' || echo "No matches found"

# 2) Potential recursion footgun: host.username derived from constants.username
echo ""
echo "=== Checking for potential recursion (username = myconfig.constants.username) ==="
rg -nP --hidden -g '!.git/**' \
  '(^|\s)username\s*=\s*myconfig\.constants\.username\b' || echo "No matches found"

# 3) Additional check: Look at the specific file and surrounding context
echo ""
echo "=== Contents of hosts/CB14957.local/default.nix (first 50 lines) ==="
head -50 hosts/CB14957.local/default.nix

Repository: connerohnesorge/dotfiles

Length of output: 8855


Fix remaining hardcoded usernames and paths to support multi-user deployments.

The verification found hardcoded usernames/paths throughout the codebase:

  • flake.nix:144: homeManagerUser = "connerohnesorge"
  • .zshrc: Multiple hardcoded paths like /home/connerohnesorge/ and /Users/connerohnesorge/
  • .config/home-manager/flake.nix: Hardcoded username = "cohnesor" and username = "connerohnesorge"

Additionally, this file (hosts/CB14957.local/default.nix:15) hardcodes username = "cohnesor" instead of deriving it from myconfig.constants.username. Use the host/constants pattern consistently across all configurations.

Good news: No host→constants recursion patterns detected.

🤖 Prompt for AI Agents
In @hosts/CB14957.local/default.nix around lines 1 - 112, The username is
hardcoded as "cohnesor" in the host definition (symbol: username = "cohnesor")
which breaks multi-user deployments; replace that literal with the constant
reference used elsewhere (myconfig.constants.username) so the host uses the
centralized host/constants value, and update any remaining hardcoded paths and
settings (e.g., home paths, homeManagerUser, .zshrc entries, and
.config/home-manager/flake.nix username fields referenced in the review) to
derive from the same myconfig.constants.username symbol rather than string
literals to ensure consistency across hosts.

- Switch to upstream zen-browser-flake (0xc000022070) with Home Manager module
- Add firefox-addons input from nur-expressions for extension management
- Configure zen-browser in home.nix with default profile and extensions
- Add firefox-addons overlay to nixpkgs in rices.nix for NixOS and Darwin
- Remove zen-browser from engineer.nix (now managed by home-manager)
- Fix multi-user support: homeManagerUser now defaults to host username

Extensions configured:
- surfingkeys: Vim-style keyboard navigation
- keeper-password-manager: Password management

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
modules/config/rices.nix (1)

56-67: Reconsider overlay placement for better separation of concerns.

The firefox-addons overlay is being applied in the rices (theming) module, but this module's purpose is theme management via Stylix. Browser extension overlays would be better placed in:

  • modules/config/home.nix (where zen-browser is actually configured), or
  • A dedicated browser feature module (e.g., modules/features/browser.nix)

This would maintain clearer module boundaries and keep theming concerns separate from browser functionality.

♻️ Suggested refactor

Move the overlay to modules/config/home.nix where zen-browser is configured:

In modules/config/home.nix, add to the home.always section:

  home.always = {myconfig, ...}: let
    inherit (myconfig.constants) username;
  in {
+   nixpkgs.overlays = [inputs.firefox-addons.overlays.default];
+
    imports = [
      inputs.zen-browser.homeModules.beta
    ];

Then remove lines 56-67 from modules/config/rices.nix.

modules/config/home.nix (1)

32-45: Consider making zen-browser optional via a feature module.

Currently, zen-browser is configured in home.always, which applies to all hosts and users unconditionally. Based on the repository's feature system pattern, browser configuration should be optional and enabled per-host.

Consider moving this configuration to:

  • modules/features/engineer.nix (if it's part of the engineering workflow), or
  • A new modules/features/browser.nix module

This would allow hosts to opt-in via myconfig.features.browser.enable = true and maintain flexibility for different machine profiles.

♻️ Example refactor to feature module

Create or update modules/features/engineer.nix (or a new browser module):

{
  delib,
  inputs,
  pkgs,
  ...
}:
delib.module {
  name = "engineer-browser";
  
  home.ifEnabled = {
    imports = [
      inputs.zen-browser.homeModules.beta
    ];

    programs.zen-browser = {
      enable = true;
      profiles.default = {
        isDefault = true;
        extensions.packages = with pkgs.firefox-addons; [
          surfingkeys
          keeper-password-manager
        ];
      };
    };
  };
}

Then remove lines 32-45 from modules/config/home.nix.

Based on learnings, feature modules should define platform-specific configuration in separate sections using home.ifEnabled for optional features.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d63fddd and 903c7d3.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • flake.nix
  • modules/config/home.nix
  • modules/config/hosts.nix
  • modules/config/rices.nix
  • modules/features/engineer.nix
🚧 Files skipped from review as they are similar to previous changes (2)
  • modules/config/hosts.nix
  • modules/features/engineer.nix
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{nix,rs,py}

📄 CodeRabbit inference engine (GEMINI.md)

Use nix fmt to format code using treefmt (alejandra for Nix, rustfmt for Rust, black for Python)

Files:

  • flake.nix
  • modules/config/rices.nix
  • modules/config/home.nix
**/*.nix

📄 CodeRabbit inference engine (AGENTS.md)

**/*.nix: Use alejandra formatting for Nix files
Prefer let...in blocks in Nix code
Use kebab-case for Nix attributes

Files:

  • flake.nix
  • modules/config/rices.nix
  • modules/config/home.nix
**/*.{py,nix}

📄 CodeRabbit inference engine (AGENTS.md)

Use snake_case for file and function names

Files:

  • flake.nix
  • modules/config/rices.nix
  • modules/config/home.nix
modules/**/*.nix

📄 CodeRabbit inference engine (AGENTS.md)

modules/**/*.nix: Use delib.module pattern for Nix modules
Use platform-specific sections: nixos.ifEnabled, darwin.ifEnabled, home.ifEnabled for multi-platform support

Files:

  • modules/config/rices.nix
  • modules/config/home.nix
🧠 Learnings (14)
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/constants.nix : In `modules/config/constants.nix`, define read-only user constants such as username and email

Applied to files:

  • flake.nix
  • modules/config/home.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/constants.nix : Use `modules/config/constants.nix` for read-only user constants (username, email, etc.)

Applied to files:

  • flake.nix
  • modules/config/home.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/args.nix : In `modules/config/args.nix`, define shared arguments between nixos and home-manager configurations

Applied to files:

  • flake.nix
  • modules/config/rices.nix
  • modules/config/home.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/args.nix : Use `modules/config/args.nix` for shared arguments between nixos and home-manager configurations

Applied to files:

  • flake.nix
  • modules/config/rices.nix
  • modules/config/home.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to modules/config/hosts.nix : In `modules/config/hosts.nix`, define host type definitions and feature mapping system

Applied to files:

  • flake.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to hosts/**/*.nix : In Nix host configuration files, use the `delib.host` pattern with type classification (desktop/laptop/server) and enable features through `myconfig.features.*`

Applied to files:

  • flake.nix
  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/config/hosts.nix : Use `modules/config/hosts.nix` for host type definitions and feature mapping system

Applied to files:

  • flake.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to hosts/**/*.nix : Enable features in host configurations using `myconfig.features.featureName = true` syntax

Applied to files:

  • flake.nix
  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to modules/features/**/*.nix : Define platform-specific configuration in separate sections using `nixos.ifEnabled`, `darwin.ifEnabled`, and `home.ifEnabled` for feature modules

Applied to files:

  • flake.nix
  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:24:35.117Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-28T14:24:35.117Z
Learning: Applies to rices/**/*.nix : Use `delib.rice` with Stylix integration for theme configurations

Applied to files:

  • flake.nix
  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to rices/**/*.nix : Use Stylix-compatible configuration in theme modules for consistent theming across applications

Applied to files:

  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: Applies to rices/**/*.nix : In Nix rice (theme) configuration files, use the `delib.rice` pattern with Stylix integration for consistent theming across applications using Base16 color schemes

Applied to files:

  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:25:08.335Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-28T14:25:08.335Z
Learning: When creating new feature modules in Nix, consider both nixos and darwin platforms and define platform-specific configuration in separate conditional sections

Applied to files:

  • modules/config/rices.nix
📚 Learning: 2025-11-28T14:25:42.835Z
Learnt from: CR
Repo: connerohnesorge/dotfiles PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T14:25:42.835Z
Learning: Applies to modules/**/*.nix : Use platform-specific sections: `nixos.ifEnabled`, `darwin.ifEnabled`, `home.ifEnabled` for multi-platform support

Applied to files:

  • modules/config/rices.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build (macos-aarch64)
  • GitHub Check: Validate Templates (linux-x86_64)
  • GitHub Check: Validate Templates (macos-aarch64)
  • GitHub Check: Build (linux-x86_64)
🔇 Additional comments (4)
flake.nix (3)

6-10: LGTM - Input follows improve dependency consistency.

Restructuring zen-browser to follow the flake's nixpkgs and home-manager inputs prevents duplicate dependencies and ensures version consistency across the configuration.


12-15: LGTM - firefox-addons input structure is correct.

The input configuration properly follows nixpkgs and uses the dir parameter to reference the specific package directory.


154-155: Good documentation of the dynamic username behavior.

The comment clearly explains that username is now set per-host rather than globally, which aligns with the PR's multi-user support objective.

modules/config/home.nix (1)

21-21: LGTM - inputs parameter is necessary.

Adding the inputs parameter enables access to the zen-browser flake input.

@connerohnesorge connerohnesorge merged commit de7b275 into main Jan 18, 2026
7 checks passed
@connerohnesorge connerohnesorge deleted the feature/multi-user-support branch January 18, 2026 23:36
@coderabbitai coderabbitai bot mentioned this pull request Jan 21, 2026
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.

2 participants