-
Notifications
You must be signed in to change notification settings - Fork 0
Add multi-user support for different machines #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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]>
WalkthroughMake 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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”, butconstants.usernameis 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 keepconstants.*truly immutable. Based on coding guidelines / learnings,modules/config/constants.nixis 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.usernamecan’t silently drift due to another module assignment.modules/config/hosts.nix (1)
35-37: Nice addition: per-hostusernameoption.One guardrail to consider: avoid (or assert against) host configs setting
host.usernamefrommyconfig.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 dynamicusername.Optional for consistency: mirror the same
usernamebinding usage in the NixOStrusted-users/allowed-userslists (instead of re-interpolatingmyconfig.constants.username).hosts/CB14957.local/default.nix (1)
53-112: Reduce duplication: bindusername = myconfig.constants.usernameonce 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
📒 Files selected for processing (9)
.config/home-manager/flake.nix.config/home-manager/home-darwin.nix.config/home-manager/home.nixhosts/CB14957.local/default.nixhosts/mac-nix/default.nixmodules/config/constants.nixmodules/config/hosts.nixmodules/config/user.nixmodules/features/engineer.nix
🧰 Additional context used
📓 Path-based instructions (8)
modules/config/constants.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use
modules/config/constants.nixfor 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 fmtto format code using treefmt (alejandra for Nix, rustfmt for Rust, black for Python)
Files:
modules/config/constants.nixhosts/mac-nix/default.nixmodules/config/hosts.nixmodules/config/user.nixhosts/CB14957.local/default.nixmodules/features/engineer.nix
**/*.nix
📄 CodeRabbit inference engine (AGENTS.md)
**/*.nix: Use alejandra formatting for Nix files
Preferlet...inblocks in Nix code
Use kebab-case for Nix attributes
Files:
modules/config/constants.nixhosts/mac-nix/default.nixmodules/config/hosts.nixmodules/config/user.nixhosts/CB14957.local/default.nixmodules/features/engineer.nix
modules/**/*.nix
📄 CodeRabbit inference engine (AGENTS.md)
modules/**/*.nix: Usedelib.modulepattern for Nix modules
Use platform-specific sections:nixos.ifEnabled,darwin.ifEnabled,home.ifEnabledfor multi-platform support
Files:
modules/config/constants.nixmodules/config/hosts.nixmodules/config/user.nixmodules/features/engineer.nix
**/*.{py,nix}
📄 CodeRabbit inference engine (AGENTS.md)
Use snake_case for file and function names
Files:
modules/config/constants.nixhosts/mac-nix/default.nixmodules/config/hosts.nixmodules/config/user.nixhosts/CB14957.local/default.nixmodules/features/engineer.nix
hosts/**/*.nix
📄 CodeRabbit inference engine (CLAUDE.md)
hosts/**/*.nix: Use thedelib.hostpattern with type classification (desktop/laptop/server) for host configurations
Enable features in host configurations usingmyconfig.features.featureName = truesyntaxIn Nix host configuration files, use the
delib.hostpattern with type classification (desktop/laptop/server) and enable features throughmyconfig.features.*
Files:
hosts/mac-nix/default.nixhosts/CB14957.local/default.nix
modules/config/hosts.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use
modules/config/hosts.nixfor host type definitions and feature mapping systemIn
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 thedelib.modulepattern withsingleEnableOption falsefor feature modules inmodules/features/
Define platform-specific configuration in separate sections usingnixos.ifEnabled,darwin.ifEnabled, andhome.ifEnabledfor feature modulesIn Nix module files, use the
delib.modulepattern withsingleEnableOption falsefor 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.nixmodules/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.nixmodules/config/constants.nix.config/home-manager/home-darwin.nixhosts/CB14957.local/default.nixmodules/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.nixmodules/config/constants.nixhosts/mac-nix/default.nixmodules/config/hosts.nix.config/home-manager/home-darwin.nixmodules/config/user.nixhosts/CB14957.local/default.nixmodules/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.nixmodules/config/constants.nixhosts/mac-nix/default.nixmodules/config/hosts.nix.config/home-manager/home-darwin.nixmodules/config/user.nixhosts/CB14957.local/default.nixmodules/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.nixhosts/mac-nix/default.nixmodules/config/hosts.nixhosts/CB14957.local/default.nixmodules/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.nixhosts/mac-nix/default.nixmodules/config/hosts.nixhosts/CB14957.local/default.nixmodules/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.nixhosts/mac-nix/default.nixmodules/config/hosts.nixhosts/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.nixhosts/mac-nix/default.nixmodules/config/hosts.nixhosts/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.nixhosts/CB14957.local/default.nixmodules/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.nixhosts/CB14957.local/default.nixmodules/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.nixmodules/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:usernameparameterization and derivedhomeDirectory.This matches the multi-user goal and keeps a sensible default.
.config/home-manager/home-darwin.nix (1)
1-16: Good: macOSusernameparameterization and/Users/${username}.Looks consistent with the Linux Home Manager module approach.
hosts/CB14957.local/default.nix (1)
11-33: Host-levelusername = "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 derivesprimaryUserand user home frommyconfig.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.usernamefor user constants.
27-27: LGTM! Consistent function pattern for dynamic configuration.Converting
nixos.ifEnabledto a function acceptingmyconfigis consistent with thenixos.alwayspattern 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
extraSpecialArgsto pass the username to the sharedhome-darwin.nixmodule, 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
extraSpecialArgspattern as the macOS configs, enabling consistent multi-user support across platforms. The shared module approach (./home.nix) with parameterized usernames promotes maintainability.
| { | ||
| 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; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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.nixRepository: 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: Hardcodedusername = "cohnesor"andusername = "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]>
There was a problem hiding this 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-addonsoverlay 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.nixwhere zen-browser is configured:In
modules/config/home.nix, add to thehome.alwayssection: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.nixmoduleThis would allow hosts to opt-in via
myconfig.features.browser.enable = trueand 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.ifEnabledfor optional features.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
flake.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
flake.nixmodules/config/home.nixmodules/config/hosts.nixmodules/config/rices.nixmodules/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 fmtto format code using treefmt (alejandra for Nix, rustfmt for Rust, black for Python)
Files:
flake.nixmodules/config/rices.nixmodules/config/home.nix
**/*.nix
📄 CodeRabbit inference engine (AGENTS.md)
**/*.nix: Use alejandra formatting for Nix files
Preferlet...inblocks in Nix code
Use kebab-case for Nix attributes
Files:
flake.nixmodules/config/rices.nixmodules/config/home.nix
**/*.{py,nix}
📄 CodeRabbit inference engine (AGENTS.md)
Use snake_case for file and function names
Files:
flake.nixmodules/config/rices.nixmodules/config/home.nix
modules/**/*.nix
📄 CodeRabbit inference engine (AGENTS.md)
modules/**/*.nix: Usedelib.modulepattern for Nix modules
Use platform-specific sections:nixos.ifEnabled,darwin.ifEnabled,home.ifEnabledfor multi-platform support
Files:
modules/config/rices.nixmodules/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.nixmodules/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.nixmodules/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.nixmodules/config/rices.nixmodules/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.nixmodules/config/rices.nixmodules/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.nixmodules/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.nixmodules/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.nixmodules/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.nixmodules/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
inputsparameter enables access to the zen-browser flake input.
Summary
usernameoption allowing different usernames per machineCB14957.local) with usernamecohnesormyconfig.constants.usernameChanges
modules/config/hosts.nix- Addedusernameoption with defaultmodules/config/constants.nix- Username derives from host configmodules/config/user.nix- Fixed hardcoded usernamesmodules/features/engineer.nix- Dynamic NordVPN users and nh flake pathhosts/mac-nix/default.nix- Uses dynamic username patternhosts/CB14957.local/default.nix- New work machine config.config/home-manager/*- Updated to support multiple usersUsage
Test plan
nix flake checkpasses🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.