Moved scripts to the overlay folder to be used as packages

All scripts have been moved to the overlay folder in the top level directory

Overlay is now instantiated per configuration to make use of the host variable
This commit is contained in:
2024-11-16 03:42:07 -05:00
parent 2a2263d4cb
commit 8c007c3915
27 changed files with 200 additions and 175 deletions

View File

@@ -0,0 +1,40 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "keyring";
runtimeInputs = with pkgs; [
pass
findutils
ripgrep
fzf
wl-clipboard
coreutils
];
text = ''
#!/run/current-system/sw/bin/bash
# prevent multiple instances, conditional check happens in the hyprland bind
touch /tmp/keyringfile
trap "[ -f /tmp/keyringfile ] && /run/current-system/sw/bin/rm /tmp/keyringfile" EXIT SIGHUP SIGINT
# get passwords from password store, remove .password store/ prefix and .gpg suffix, exlude .gpg-id file, open results in fzf
pass_string=$(find "$HOME"/.password-store -type f | sed 's|.*/.password-store/||; s|\.gpg$||' | sed 's|^\([^/]*\)|\x1b[32m\1\x1b[0m|' | rg -v "\.git|.gpg-id" | sort -r | fzf --border --border-label="$(whoami)'s keyring" --ansi --layout=reverse)
# prevents cliphist from writing passwords to the clipboard history
pkill -STOP wl-paste
# copy password
pass -c "$pass_string" > /dev/null
echo "Password copied. Clearing clipboard in 10 seconds."
# start a timer for 10 seconds, clear clipboard, resume cliphist tracking
nohup bash <<-EOF > /dev/null &
sleep 10
wl-copy -c
pkill -CONT wl-paste
EOF
/run/current-system/sw/bin/rm /tmp/keyringfile
sleep 0.5
exit 0
'';
}