nix-config/modules/yubikey/default.nix
2025-03-07 11:27:49 +01:00

34 lines
647 B
Nix

{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkMerge mkIf;
inherit (config) conf;
in
mkMerge [
(mkIf
conf.yubikey.enable
{
services.udev.packages = [pkgs.yubikey-personalization];
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
home-manager.users.${conf.username}.home.packages = with pkgs; [
yubioath-flutter
];
})
(mkIf
conf.yubikey.login
{
security.pam.services = {
login.u2fAuth = true;
sudo.u2fAuth = true;
};
})
]