This commit is contained in:
caandt 2025-02-25 16:36:22 -06:00
parent 05a2111bc1
commit 0d4d413f94
4 changed files with 43 additions and 21 deletions

View file

@ -14,31 +14,24 @@
./plasma.nix ./plasma.nix
./security.nix ./security.nix
./virt.nix ./virt.nix
./yubikey.nix
../overlays ../overlays
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];
options.u = { options.u = {
has = { has = let
graphical = lib.mkOption { mkOpt = name:
lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
description = "enable graphical settings"; description = "enable ${name}";
default = true;
};
wine = lib.mkOption {
type = lib.types.bool;
description = "enable wine settings";
default = true;
};
virt = lib.mkOption {
type = lib.types.bool;
description = "enable virt settings";
default = true;
};
container = lib.mkOption {
type = lib.types.bool;
description = "enable container settings";
default = true; default = true;
}; };
in {
graphical = mkOpt "graphical";
wine = mkOpt "wine";
virt = mkOpt "virt";
container = mkOpt "container";
yubikey = mkOpt "yubikey";
}; };
}; };
} }

25
system/yubikey.nix Normal file
View file

@ -0,0 +1,25 @@
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.yubikey {
environment.systemPackages = [
pkgs.yubikey-manager
pkgs.yubioath-flutter
pkgs.pam_u2f
];
services.pcscd.enable = true;
services.udev.packages = [pkgs.yubikey-personalization];
services.yubikey-agent.enable = true;
security.pam = {
u2f = {
enable = true;
settings.cue = true;
};
services.login.u2fAuth = false;
services.physlock.u2fAuth = false;
};
programs.yubikey-touch-detector.enable = true;
}

View file

@ -18,6 +18,9 @@ lib.mkIf config.u.has.graphical {
"safeeyes.service" "safeeyes.service"
"snixembed.service" "snixembed.service"
]; ];
Requires = [
"graphical-session.target"
];
}; };
}; };
systemd.user.services = { systemd.user.services = {

View file

@ -26,6 +26,7 @@
ffsubsync ffsubsync
unzip unzip
unar unar
keepassxc
] ]
++ lib.optionals config.u.has.graphical [ ++ lib.optionals config.u.has.graphical [
(config.u.lib.localHome pkgs.firefox "firefox" "bin/firefox") (config.u.lib.localHome pkgs.firefox "firefox" "bin/firefox")