refactor yubikey

This commit is contained in:
Till 2024-01-11 14:58:08 +01:00
parent d0756a68f0
commit d994ac0650
3 changed files with 21 additions and 2 deletions

View file

@ -18,9 +18,10 @@
networking.hostName = "nova"; networking.hostName = "nova";
} }
./system ./system
./system/hardware-nova.nix
./system/gnome.nix ./system/gnome.nix
./system/btrbk.nix ./system/btrbk.nix
./system/hardware-nova.nix ./system/yubikey.nix
./system/alt.nix ./system/alt.nix
]; ];
}; };

View file

@ -94,7 +94,6 @@
mullvad-vpn.enable = true; mullvad-vpn.enable = true;
}; };
services.udev.packages = [ pkgs.yubikey-personalization ];
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
programs.dconf.enable = true; programs.dconf.enable = true;

19
system/yubikey.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
{
services.udev = {
packages = [ pkgs.yubikey-personalization ];
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"
'';
};
security.pam.services = {
login.u2fAuth = true;
sudo.u2fAuth = true;
};
}