Add modules/shell/bitwarden module
For bitwarden-cli
This commit is contained in:
		
							parent
							
								
									6b43fcb14d
								
							
						
					
					
						commit
						e74a392d76
					
				|  | @ -25,4 +25,7 @@ with lib; | |||
|     latitude = 55.88; | ||||
|     longitude = 12.5; | ||||
|   } else {}); | ||||
| 
 | ||||
|   ## | ||||
|   modules.shell.bitwarden.config.server = "p.v0.io"; | ||||
| } | ||||
|  |  | |||
							
								
								
									
										25
									
								
								modules/shell/bitwarden.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								modules/shell/bitwarden.nix
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| { config, options, pkgs, lib, ... }: | ||||
| 
 | ||||
| with lib; | ||||
| with lib.my; | ||||
| let cfg = config.modules.shell.bitwarden; | ||||
| in { | ||||
|   options.modules.shell.bitwarden = with types; { | ||||
|     enable = mkBoolOpt false; | ||||
|     config = mkOpt attrs {}; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     user.packages = with pkgs; [ | ||||
|       bitwarden-cli | ||||
|     ]; | ||||
| 
 | ||||
|     modules.shell.zsh.rcInit = "_cache bw completion --shell zsh; compdef _bw bw;"; | ||||
| 
 | ||||
|     system.userActivationScripts = mkIf (cfg.config != {}) { | ||||
|       initBitwarden = '' | ||||
|         ${concatStringsSep "\n" (mapAttrsToList (n: v: "bw config ${n} ${v}") cfg.config)} | ||||
|       ''; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
		Reference in a new issue