forked from jan-leila/nix-config
		
	added users that can be disabled
This commit is contained in:
		
							parent
							
								
									b60bacf752
								
							
						
					
					
						commit
						3b76e4a8a8
					
				
					 6 changed files with 193 additions and 94 deletions
				
			
		|  | @ -1,6 +1,5 @@ | ||||||
| # leyla laptop | # leyla laptop | ||||||
| { config, pkgs, inputs, ... }: | { config, pkgs, inputs, ... }: | ||||||
| 
 |  | ||||||
| { | { | ||||||
|   imports = |   imports = | ||||||
|     [ |     [ | ||||||
|  | @ -17,6 +16,10 @@ | ||||||
| 
 | 
 | ||||||
|   sops.age.keyFile = "/home/leyla/.config/sops/age/keys.txt"; |   sops.age.keyFile = "/home/leyla/.config/sops/age/keys.txt"; | ||||||
| 
 | 
 | ||||||
|  |   users.leyla.isNormalUser = true; | ||||||
|  |   users.ester.isNormalUser = true; | ||||||
|  |   users.eve.isNormalUser = true; | ||||||
|  | 
 | ||||||
|   # Bootloader. |   # Bootloader. | ||||||
|   boot.loader.systemd-boot.enable = true; |   boot.loader.systemd-boot.enable = true; | ||||||
|   boot.loader.efi.canTouchEfiVariables = true; |   boot.loader.efi.canTouchEfiVariables = true; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| { ... }: | { ... }: | ||||||
| { | { | ||||||
|   imports = [ ./leyla ./ester ./eve ]; |   imports = [ ./leyla ./ester ./eve ./remote ]; | ||||||
| 
 | 
 | ||||||
|   users.mutableUsers = false; |   users.mutableUsers = false; | ||||||
| } | } | ||||||
|  | @ -1,15 +1,32 @@ | ||||||
| { lib, config, pkgs, ... }: | { lib, config, pkgs, ... }: | ||||||
|  | let | ||||||
|  |   cfg = config.users.ester; | ||||||
|  | in | ||||||
| { | { | ||||||
|   sops.secrets."passwords/ester" = { |   options.users.ester = { | ||||||
|  |     isNormalUser = lib.mkEnableOption "ester"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = { | ||||||
|  |     sops.secrets = lib.mkIf cfg.isNormalUser { | ||||||
|  |       "passwords/ester" = { | ||||||
|         neededForUsers = true; |         neededForUsers = true; | ||||||
|         # sopsFile = ../secrets.yaml; |         # sopsFile = ../secrets.yaml; | ||||||
|       }; |       }; | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|   # Define user accounts |     users.groups.ester = {}; | ||||||
|   users.users.ester = { | 
 | ||||||
|     isNormalUser = true; |     users.users.ester = lib.mkMerge [ | ||||||
|  |       { | ||||||
|         uid = 1001; |         uid = 1001; | ||||||
|         description = "Ester"; |         description = "Ester"; | ||||||
|  |         group = "ester"; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       ( | ||||||
|  |         if cfg.isNormalUser then { | ||||||
|  |           isNormalUser = true; | ||||||
|           extraGroups = [ "networkmanager" ]; |           extraGroups = [ "networkmanager" ]; | ||||||
| 
 | 
 | ||||||
|           hashedPasswordFile = config.sops.secrets."passwords/ester".path; |           hashedPasswordFile = config.sops.secrets."passwords/ester".path; | ||||||
|  | @ -19,5 +36,10 @@ | ||||||
|             bitwarden |             bitwarden | ||||||
|             discord |             discord | ||||||
|           ]; |           ]; | ||||||
|  |         } else { | ||||||
|  |           isSystemUser = true; | ||||||
|  |         } | ||||||
|  |       ) | ||||||
|  |     ]; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  | @ -1,15 +1,32 @@ | ||||||
| { lib, config, pkgs, ... }: | { lib, config, pkgs, ... }: | ||||||
|  | let | ||||||
|  |   cfg = config.users.eve; | ||||||
|  | in | ||||||
| { | { | ||||||
|   sops.secrets."passwords/eve" = { |   options.users.eve = { | ||||||
|  |     isNormalUser = lib.mkEnableOption "eve"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = { | ||||||
|  |     sops.secrets = lib.mkIf cfg.isNormalUser { | ||||||
|  |       "passwords/eve" = { | ||||||
|         neededForUsers = true; |         neededForUsers = true; | ||||||
|         # sopsFile = ../secrets.yaml; |         # sopsFile = ../secrets.yaml; | ||||||
|       }; |       }; | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|   # Define user accounts |     users.groups.eve = {}; | ||||||
|   users.users.eve = { | 
 | ||||||
|     isNormalUser = true; |     users.users.eve = lib.mkMerge [ | ||||||
|  |       { | ||||||
|         uid = 1002; |         uid = 1002; | ||||||
|         description = "Eve"; |         description = "Eve"; | ||||||
|  |         group = "eve"; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       ( | ||||||
|  |         if cfg.isNormalUser then { | ||||||
|  |           isNormalUser = true; | ||||||
|           extraGroups = [ "networkmanager" ]; |           extraGroups = [ "networkmanager" ]; | ||||||
| 
 | 
 | ||||||
|           hashedPasswordFile = config.sops.secrets."passwords/eve".path; |           hashedPasswordFile = config.sops.secrets."passwords/eve".path; | ||||||
|  | @ -21,5 +38,10 @@ | ||||||
|             makemkv |             makemkv | ||||||
|             signal-desktop |             signal-desktop | ||||||
|           ]; |           ]; | ||||||
|  |         } else { | ||||||
|  |           isSystemUser = true; | ||||||
|  |         } | ||||||
|  |       ) | ||||||
|  |     ]; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  | @ -1,15 +1,32 @@ | ||||||
| { lib, config, pkgs, ... }: | { lib, config, pkgs, ... }: | ||||||
|  | let | ||||||
|  |   cfg = config.users.leyla; | ||||||
|  | in | ||||||
| { | { | ||||||
|   sops.secrets."passwords/leyla" = { |   options.users.leyla = { | ||||||
|  |     isNormalUser = lib.mkEnableOption "leyla"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = { | ||||||
|  |     sops.secrets = lib.mkIf cfg.isNormalUser { | ||||||
|  |       "passwords/leyla" = { | ||||||
|         neededForUsers = true; |         neededForUsers = true; | ||||||
|         # sopsFile = ../secrets.yaml; |         # sopsFile = ../secrets.yaml; | ||||||
|       }; |       }; | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|   # Define user accounts |     users.groups.leyla = {}; | ||||||
|   users.users.leyla = { | 
 | ||||||
|     isNormalUser = true; |     users.users.leyla = lib.mkMerge [ | ||||||
|  |       { | ||||||
|         uid = 1000; |         uid = 1000; | ||||||
|         description = "Leyla"; |         description = "Leyla"; | ||||||
|  |         group = "leyla"; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       ( | ||||||
|  |         if cfg.isNormalUser then { | ||||||
|  |           isNormalUser = true; | ||||||
|           extraGroups = [ "networkmanager" "wheel" ]; |           extraGroups = [ "networkmanager" "wheel" ]; | ||||||
| 
 | 
 | ||||||
|           hashedPasswordFile = config.sops.secrets."passwords/leyla".path; |           hashedPasswordFile = config.sops.secrets."passwords/leyla".path; | ||||||
|  | @ -65,5 +82,10 @@ | ||||||
|             # DS Emulator |             # DS Emulator | ||||||
|             desmume |             desmume | ||||||
|           ]; |           ]; | ||||||
|  |         } else { | ||||||
|  |           isSystemUser = true; | ||||||
|  |         } | ||||||
|  |       ) | ||||||
|  |     ]; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
							
								
								
									
										30
									
								
								users/remote/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								users/remote/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | ||||||
|  | {  lib, config, ... }: | ||||||
|  | let | ||||||
|  |   cfg = config.users.remote; | ||||||
|  | in | ||||||
|  | { | ||||||
|  |   options.users.remote = { | ||||||
|  |     isNormalUser = lib.mkEnableOption "remote"; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config.users = { | ||||||
|  |     groups.remote = {}; | ||||||
|  | 
 | ||||||
|  |     users.remote = lib.mkMerge [ | ||||||
|  |       { | ||||||
|  |         uid = 2000; | ||||||
|  |         group = "remote"; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       ( | ||||||
|  |         if cfg.isNormalUser then { | ||||||
|  |           # extraGroups = [ "wheel" ]; | ||||||
|  |           isNormalUser = true; | ||||||
|  |           openssh.authorizedKeys.keys = []; | ||||||
|  |         } else { | ||||||
|  |           isSystemUser = true; | ||||||
|  |         } | ||||||
|  |       ) | ||||||
|  |     ]; | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue