Commit 9eb4501

HPCesia <me@hpcesia.com>
2025-10-03 15:19:34
refactor: migrate yubikey configs
1 parent 4a9b8db
Changed files (3)
home
linux
modules
os-modules
nixos
home/linux/gui/misc.nix
@@ -29,8 +29,4 @@ in {
     libreoffice-qt6
     blender
   ];
-
-  # Fix pcsc conflict
-  # https://github.com/LudovicRousseau/PCSC/issues/65
-  programs.gpg.scdaemonSettings.disable-ccid = true;
 }
modules/desktop/yubikey.nix
@@ -0,0 +1,13 @@
+{
+  flake.modules.nixos.desktop = {pkgs, ...}: {
+    services.udev.packages = [pkgs.yubikey-personalization];
+    hardware.gpgSmartcards.enable = true;
+    services.pcscd.enable = true;
+  };
+
+  flake.modules.homeManager.desktop = _: {
+    # Fix pcsc conflict
+    # https://github.com/LudovicRousseau/PCSC/issues/65
+    programs.gpg.scdaemonSettings.disable-ccid = true;
+  };
+}
os-modules/nixos/desktop/security.nix
@@ -1,15 +0,0 @@
-{pkgs, ...}: {
-  services.udev.packages = [pkgs.yubikey-personalization];
-  # Locking the screen when a Yubikey is unplugged
-  # https://nixos.wiki/wiki/Yubikey#Locking_the_screen_when_a_Yubikey_is_unplugged
-  services.udev.extraRules = ''
-    ACTION=="remove",\
-     ENV{ID_BUS}=="usb",\
-     ENV{ID_MODEL_ID}=="0407",\
-     ENV{ID_VENDOR_ID}=="1050",\
-     ENV{ID_VENDOR}=="Yubico",\
-     RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
-  '';
-  hardware.gpgSmartcards.enable = true;
-  services.pcscd.enable = true;
-}