Files
nixos/custom-pkgs/otp/package.nix
Joakim Repomaa ea7c4cbf31 global pkgs
2025-01-30 19:33:33 +02:00

18 lines
418 B
Nix

{ pkgs }:
let
ykman = "${pkgs.yubikey-manager}/bin/ykman";
sk = "${pkgs.skim}/bin/sk";
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
in
pkgs.writeShellScriptBin "otp" ''
skim_command=("${sk}")
if [ -n "$*" ]; then
skim_command+=(-q "$*")
fi
account=$(${ykman} oath accounts list | "''${skim_command[@]}")
[ -z "$account" ] && exit 1
${ykman} oath accounts code -s "$account" | ${wl-copy} -n
''