commit 771a70acb3de46ba32a207e9826d553d88f86062
parent cf950cc179708af3deb25a33642fea403d6c6f70
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 19 Mar 2025 11:25:09 +0100
parent cf950cc179708af3deb25a33642fea403d6c6f70
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 19 Mar 2025 11:25:09 +0100
configurations/homeManager/programs/bitwarden-cli: add `bw-unlock` shell-fuction
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/configurations/homeManager/programs/bitwarden-cli.nix b/configurations/homeManager/programs/bitwarden-cli.nix @@ -4,4 +4,18 @@ home.packages = [ pkgs.bitwarden-cli ]; + programs = let + shellExtraInit = '' + bw-unlock () { + if [[ -z $BW_SESSION ]] ; then + >&2 echo 'bw locked - unlocking into a new session' + export BW_SESSION="$(bw unlock --raw)" + fi + } + ''; + in { + zsh.initExtra = shellExtraInit; + bash.initExtra = shellExtraInit; + }; + }