You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
633 B
Nix

{
config,
lib,
osConfig ? null,
...
}:
let
cfg = config.services.gpg-agent;
hwSmartcards = osConfig.hardware.gpgSmartcards.enable;
scDaemon = cfg.enable && cfg.enableScDaemon;
in
{
config = lib.mkIf (!builtins.isNull osConfig) {
assertions = [
{
assertion = scDaemon -> hwSmartcards;
message = ''
gpg-agents scDaemon is enabled but NixOS hardware.gpgSmartcards is disabled
'';
}
];
warnings = [
(lib.mkIf (hwSmartcards && !scDaemon) ''
NixOS hardware.gpgSmartcards is enabled but gpg-agents scDaemon is disabled
'')
];
};
}