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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
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
'')
];
};
}