19 lines
497 B
Nix
19 lines
497 B
Nix
|
{ config, pkgs, ... }:
|
||
|
|
||
|
pkgs.writeScriptBin "choose-pass" ''
|
||
|
#!${pkgs.dash}/bin/dash
|
||
|
|
||
|
prefix=''${PASSWORD_STORE_DIR-"''${HOME}/.password-store"}
|
||
|
|
||
|
sel=$(
|
||
|
${pkgs.findutils}/bin/find "$prefix" -name '*.gpg' | \
|
||
|
${pkgs.gnused}/bin/sed -E "s|^''${prefix}/?||" | \
|
||
|
${pkgs.gnused}/bin/sed 's/.gpg$//' | \
|
||
|
/usr/local/bin/choose -f Inter -s 20 -c fbf1c7 -b 458588
|
||
|
)
|
||
|
|
||
|
[ -n "$sel" ] || exit
|
||
|
|
||
|
${pkgs.pass}/bin/pass show "$sel" | tr -d "\n" | /usr/bin/pbcopy
|
||
|
''
|