Enable U2F on linux systems

This commit is contained in:
Natsu Kagami 2022-05-15 14:46:17 -04:00
parent 8e37bc2a7e
commit 3c4414fcb3
Signed by: nki
GPG key ID: 7306B3D3C3AD6E51
2 changed files with 31 additions and 0 deletions

29
modules/personal/u2f.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.personal.u2f;
in
{
options.personal.u2f = {
enable = mkEnableOption "Enable personal U2F login modules and stuff";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
pam_u2f # for pamu2fcfg
];
security.pam = mkIf (strings.hasSuffix "linux" pkgs.system) {
u2f = {
enable = true;
cue = true;
interactive = true;
};
# Services
services.sudo.u2fAuth = true;
services.login.u2fAuth = true;
services.swaylock.u2fAuth = mkIf (config.services.swaylock.enable) true;
};
};
}