From 5948bab4ec817e5887fed9fa375da81207560794 Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 6 Jun 2025 00:53:57 +0200 Subject: Patch yubikey-touch-detector for better message and icon Signed-off-by: Mel --- flake.nix | 1 + modules/hardware-keys.nix | 20 ++++++++++++++------ overlay.nix | 7 +++++++ pkgs/default.nix | 2 ++ pkgs/yubikey-touch-detector/default.nix | 14 ++++++++++++++ pkgs/yubikey-touch-detector/touch.svg | 18 ++++++++++++++++++ .../yubikey-touch-detector.patch | 16 ++++++++++++++++ 7 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 overlay.nix create mode 100644 pkgs/yubikey-touch-detector/default.nix create mode 100644 pkgs/yubikey-touch-detector/touch.svg create mode 100644 pkgs/yubikey-touch-detector/yubikey-touch-detector.patch diff --git a/flake.nix b/flake.nix index 9266056..488b814 100644 --- a/flake.nix +++ b/flake.nix @@ -57,6 +57,7 @@ agenix.overlays.default nix-vscode-extensions.overlays.default nixpkgs-esp-dev.overlays.default + (import ./overlay.nix) ]; packageSets = diff --git a/modules/hardware-keys.nix b/modules/hardware-keys.nix index e6ae089..f101964 100644 --- a/modules/hardware-keys.nix +++ b/modules/hardware-keys.nix @@ -15,15 +15,23 @@ # see `modules/home/yubikeys.nix` for the YubiKey # universal second factor (u2f) configuration file. security = { - pam.services = { - login.u2fAuth = true; - sudo.u2fAuth = true; + pam = { + services = { + login.u2fAuth = true; + sudo.u2fAuth = true; + }; + + mount.enable = true; }; }; environment.systemPackages = with pkgs; [ - yubikey-manager yubikey-manager-qt - yubikey-personalization yubikey-personalization-gui - age-plugin-yubikey pam_u2f + yubikey-manager + yubikey-manager-qt + yubikey-personalization + yubikey-personalization-gui + yubikey-touch-detector # install icon + age-plugin-yubikey + pam_u2f ]; } diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..1eccde6 --- /dev/null +++ b/overlay.nix @@ -0,0 +1,7 @@ +final: prev: + +{ + yubikey-touch-detector = import ./pkgs/yubikey-touch-detector { + inherit (prev) yubikey-touch-detector; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 642ebc9..ddaf684 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -16,4 +16,6 @@ youcompleteme = pkgs.callPackage ./youcompleteme.nix { }; wine = pkgs.callPackage ./wine.nix { }; + + yubikey-touch-detector = pkgs.callPackage ./yubikey-touch-detector { }; } diff --git a/pkgs/yubikey-touch-detector/default.nix b/pkgs/yubikey-touch-detector/default.nix new file mode 100644 index 0000000..a1642ec --- /dev/null +++ b/pkgs/yubikey-touch-detector/default.nix @@ -0,0 +1,14 @@ +{ yubikey-touch-detector, ... }: + +yubikey-touch-detector.overrideAttrs (attrs: { + patches = [ ./yubikey-touch-detector.patch ]; + + postInstall = + (attrs.postInstall or "") + + '' + rm $out/share/icons/hicolor/128x128/apps/yubikey-touch-detector.png + + install -Dm444 -T ${./touch.svg} \ + $out/share/icons/hicolor/scalable/apps/yubikey-touch-symbolic.svg + ''; +}) diff --git a/pkgs/yubikey-touch-detector/touch.svg b/pkgs/yubikey-touch-detector/touch.svg new file mode 100644 index 0000000..739730d --- /dev/null +++ b/pkgs/yubikey-touch-detector/touch.svg @@ -0,0 +1,18 @@ + + + + + diff --git a/pkgs/yubikey-touch-detector/yubikey-touch-detector.patch b/pkgs/yubikey-touch-detector/yubikey-touch-detector.patch new file mode 100644 index 0000000..084874a --- /dev/null +++ b/pkgs/yubikey-touch-detector/yubikey-touch-detector.patch @@ -0,0 +1,16 @@ +--- a/notifier/libnotify.go ++++ b/notifier/libnotify.go +@@ -32,9 +32,10 @@ func SetupLibnotifyNotifier(notifiers *sync.Map) { + } + + notification := notify.Notification{ +- AppName: "yubikey-touch-detector", +- AppIcon: "yubikey-touch-detector", +- Summary: "YubiKey is waiting for a touch", ++ AppName: "YubiKey", ++ AppIcon: "yubikey-touch-symbolic", ++ Summary: "Waiting for touch", ++ Body: "Confirm presence by touching your YubiKey.", + } + + reset := func(msg *notify.NotificationClosedSignal) { -- cgit 1.4.1