feat: update yubikey configuration

This commit is contained in:
Jo 2024-12-23 18:33:51 +01:00
parent d06c14e32d
commit 27829eb0fc

View file

@ -17,6 +17,7 @@ in
example = [ "123456" "1234567" ]; example = [ "123456" "1234567" ];
description = "Register additional Yubikey IDs."; description = "Register additional Yubikey IDs.";
}; };
enable-agent = mkEnableOption "Enable the Yubikey agent";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -34,5 +35,16 @@ in
login.u2fAuth = true; login.u2fAuth = true;
sudo.u2fAuth = true; sudo.u2fAuth = true;
}; };
services.yubikey-agent.enable = cfg.enable-agent;
programs.ssh.extraConfig = mkIf cfg.enable-agent ''
Host *
IdentityAgent /usr/local/var/run/yubikey-agent.sock
'';
environment.sessionVariables = mkIf cfg.enable-agent {
SSH_AUTH_SOCK = "/usr/local/var/run/yubikey-agent.sock";
};
}; };
} }