-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| description = "Home Manager configuration of connerohnesorge"; | ||
| description = "Home Manager configuration"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
|
|
@@ -17,17 +17,38 @@ | |
| ... | ||
| }: { | ||
| homeConfigurations = { | ||
| # macOS configuration | ||
| # Personal macOS configuration | ||
| "[email protected]" = home-manager.lib.homeManagerConfiguration { | ||
| pkgs = nixpkgs.legacyPackages.aarch64-darwin; # Assuming M1/M2 Mac, use x86_64-darwin for Intel | ||
| pkgs = nixpkgs.legacyPackages.aarch64-darwin; | ||
| extraSpecialArgs = {username = "connerohnesorge";}; | ||
| modules = [ | ||
| ./home-darwin.nix | ||
| ]; | ||
| }; | ||
|
|
||
| # Linux configuration | ||
| # Work macOS configuration | ||
| "[email protected]" = home-manager.lib.homeManagerConfiguration { | ||
| pkgs = nixpkgs.legacyPackages.aarch64-darwin; | ||
| extraSpecialArgs = {username = "cohnesor";}; | ||
| modules = [ | ||
| ./home-darwin.nix | ||
| ]; | ||
| }; | ||
|
|
||
| # Personal Linux configuration | ||
| "connerohnesorge" = home-manager.lib.homeManagerConfiguration { | ||
| pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||
| extraSpecialArgs = {username = "connerohnesorge";}; | ||
| modules = [ | ||
| stylix.homeManagerModules.stylix | ||
| ./home.nix | ||
| ]; | ||
| }; | ||
|
|
||
| # Work Linux configuration (if needed) | ||
| "cohnesor" = home-manager.lib.homeManagerConfiguration { | ||
| pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||
| extraSpecialArgs = {username = "cohnesor";}; | ||
| modules = [ | ||
| stylix.homeManagerModules.stylix | ||
| ./home.nix | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| { | ||
| 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; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,13 +16,19 @@ delib.module { | |
| name = "constants"; | ||
|
|
||
| options.constants = with delib; { | ||
| # Primary username for the system (used for account creation and home directory) | ||
| username = readOnly (strOption "connerohnesorge"); | ||
| # Primary username for the system (derived from host configuration) | ||
| # This allows different usernames per machine (e.g., "connerohnesorge" locally, "cohnesor" at work) | ||
| username = strOption "connerohnesorge"; | ||
|
|
||
| # Full display name for the user (used in Git commits and system identification) | ||
| userfullname = readOnly (strOption "Conner Ohnesorge"); | ||
|
|
||
| # Primary email address (used for Git commits, SSH keys, and notifications) | ||
| useremail = readOnly (strOption "[email protected]"); | ||
| }; | ||
|
|
||
| # Derive username from host configuration | ||
| myconfig.always = {myconfig, ...}: { | ||
| constants.username = myconfig.host.username; | ||
| }; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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: Hardcodedusername = "cohnesor"andusername = "connerohnesorge"Additionally, this file (
hosts/CB14957.local/default.nix:15) hardcodesusername = "cohnesor"instead of deriving it frommyconfig.constants.username. Use the host/constants pattern consistently across all configurations.Good news: No host→constants recursion patterns detected.
🤖 Prompt for AI Agents