Skip to content
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

Illustrate multiple users vs username aliases in config.nix #134

Open
cameronraysmith opened this issue Feb 20, 2025 · 3 comments
Open

Illustrate multiple users vs username aliases in config.nix #134

cameronraysmith opened this issue Feb 20, 2025 · 3 comments
Assignees

Comments

@cameronraysmith
Copy link
Contributor

Following up on #93 and the sentiment behind srid/nixos-config#66 (comment) update

{
me = {
username = "runner";
fullname = "John Doe";
email = "[email protected]";
};
}

to

 { 
   me = { 
     username = "runner"; 
     fullname = "John Doe"; 
     email = "[email protected]"; 
   }; 
   you = { 
     username = "gunner"; 
     fullname = "Ron Poe"; 
     email = "[email protected]"; 
   };
 } 

and illustrate the distinct home manager configuration for you. It may also be valuable to illustrate the scenario essentially treating the two usernames as aliases with home manager configurations that are equivalent apart from the username, such as

rec { 
   me = { 
     username = "johndoe"; 
     fullname = "John Doe"; 
     email = "[email protected]"; 
   }; 
   meInGha = me // { 
     username = "runner"; 
   }; 
 } 
@srid srid self-assigned this Mar 17, 2025
@srid
Copy link
Member

srid commented Mar 17, 2025

One more thing we want to support is per-user home-manager configuration.

EDIT: But this is already possible through ./configurations/home/<name>

@srid
Copy link
Member

srid commented Mar 17, 2025

As of #142, we enable those users (as long as there's a configurations/home/FOO.nix file) on NixOS and nix-darwin via

# For home-manager to work.
# https://github.com/nix-community/home-manager/issues/4026#issuecomment-1565487545
users.users = lib.mapAttrs
(_: v: lib.optionalAttrs pkgs.stdenv.isDarwin {
home = "/Users/${v.username}";
} // lib.optionalAttrs pkgs.stdenv.isLinux {
isNormalUser = true;
})
flake.config.users;
# Enable home-manager for our user
home-manager.users = lib.mapAttrs
(_: v: {
imports = [ (self + /configurations/home/${v.username}.nix) ];
})
flake.config.users;

@srid
Copy link
Member

srid commented Mar 17, 2025

I took a stab at this at #143

But not super happy with the result, which seems rather too complicated, which arises form the fact that we ought to support all three setups: home-manager only, nixos or nix-darwin, nixos and nix-darwin.

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

No branches or pull requests

2 participants