summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lass/5pkgs/otpmenu/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/lass/5pkgs/otpmenu/default.nix b/lass/5pkgs/otpmenu/default.nix
new file mode 100644
index 000000000..fe6d5b94c
--- /dev/null
+++ b/lass/5pkgs/otpmenu/default.nix
@@ -0,0 +1,10 @@
+{ pkgs }:
+pkgs.writeDashBin "otpmenu" ''
+x=$(${pkgs.pass}/bin/pass git ls-files '*/otp.gpg' \
+ | ${pkgs.gnused}/bin/sed 's:/otp\.gpg$::' \
+ | ${pkgs.dmenu}/bin/dmenu
+)
+
+otp=$(${(pkgs.pass.withExtensions (ext: [ ext.pass-otp ]))}/bin/pass otp code "$x/otp")
+printf %s "$otp" | ${pkgs.xdotool}/bin/xdotool type -f -
+''