Lock Screen automatically when removing Yubikey from USB

Add an extra rule to udev which locks your session when you pull your Yubikey from its USB port.

In NixOS like this:

services.udev.extraRules = ''
  ACTION=="remove", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="1050/406/543", RUN+="${pkgs.writeScript "lock-screen" "#!/bin/sh\nexec ${pkgs.systemd}/bin/loginctl lock-sessions\n"}"
'';