{ lib, pkgs, ... }:
{
  hardware.gpgSmartcards.enable = true;

  programs.ssh.startAgent = false;

  services.udev = {
    enable = true;
    packages = [ pkgs.yubikey-personalization ];
    extraRules = ''
      SUBSYSTEM=="usb", MODE="0666"
      KERNEL=="hidraw*", SUBSYSTEM=="hidraw", TAG+="uaccess", MODE="0666"
    '';
  };

  services.pcscd.enable = true;

  programs.gnupg.agent = {
    enable = true;
    enableSSHSupport = true;
  };

  services.gnome.gnome-keyring.enable = lib.mkForce false;

  environment.systemPackages = with pkgs; [
    yubikey-personalization
    yubioath-flutter
    opensc
    pcsclite
    libfido2
  ];
}
