From da6d195afbd4d5504cadcf95bc6f0791249deeae Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Sat, 6 Apr 2024 23:00:17 +0200 Subject: [PATCH] [yubikey] Add touch-detector --- nixos/modules/hardware/yubikey/default.nix | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/nixos/modules/hardware/yubikey/default.nix b/nixos/modules/hardware/yubikey/default.nix index 116a7d1..708b9c1 100644 --- a/nixos/modules/hardware/yubikey/default.nix +++ b/nixos/modules/hardware/yubikey/default.nix @@ -6,14 +6,31 @@ in { options.sisyphus.hardware.yubikey.enable = lib.mkEnableOption "YubiKey support"; config = lib.mkIf cfg.enable { - programs.gnupg.agent = { - enable = true; - # TODO Necessary? - # enableSSHSupport = true; - # pinentryFlavor = "curses"; + programs = { + gnupg.agent = { + enable = true; + # TODO Necessary? + # enableSSHSupport = true; + # pinentryFlavor = "curses"; + }; + + # yubikey-touch-detector.enable = true; }; # Enable smart card reading services.pcscd.enable = true; + + environment.systemPackages = with pkgs; [ + yubikey-touch-detector + ]; + + # Send a notification if the YubiKey is waiting for touch. + systemd.user.services.yubikey-touch-detector = { + enable = true; + description = "Detects when your YubiKey is waiting for a touch"; + path = with pkgs; [ yubikey-touch-detector ]; + script = ''exec yubikey-touch-detector --notify''; + environment.YUBIKEY_TOUCH_DETECTOR_LIBNOTIFY = "true"; + }; }; }