nix-dev-home icon indicating copy to clipboard operation
nix-dev-home copied to clipboard

Illustrate multiple users vs username aliases in `config.nix`

Open cameronraysmith opened this issue 1 year ago • 3 comments

Following up on #93 and the sentiment behind https://github.com/srid/nixos-config/issues/66#issuecomment-2395569673 update

https://github.com/juspay/nixos-unified-template/blob/f5c0fc99f01784bfa0e3034a05dec12faca24fcf/modules/flake/config.nix#L4-L10

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"; 
   }; 
 } 

cameronraysmith avatar Feb 20 '25 02:02 cameronraysmith

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

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

srid avatar Mar 17 '25 14:03 srid

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

https://github.com/juspay/nixos-unified-template/blob/4e15da17212c7f63f68cd619ddc7e8f770b2b315/modules/nixos/common/home-manager.nix#L9-L24

srid avatar Mar 17 '25 18:03 srid

I took a stab at this at https://github.com/juspay/nixos-unified-template/pull/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.

srid avatar Mar 17 '25 23:03 srid