dotfiles.nix/nixos/common/optional/key.nix
2024-08-08 09:02:42 +08:00

27 lines
700 B
Nix

{pkgs, ...}: {
environment.systemPackages = with pkgs; [
# Enables files to be encrypted to age identities stored on YubiKeys
age-plugin-yubikey
# Setup dm-crypt managed device-mapper mappings.
cryptsetup
# Configure your YubiKey via the command line
yubikey-manager
];
# Manage secret (private) keys.
programs.gnupg.agent = {
enable = true;
# Fix: invalid time when using keytocard
pinentryPackage = pkgs.pinentry-curses;
};
# Use our yubikey as a user login or for sudo access
security.pam.services = {
login.u2fAuth = true;
sudo.u2fAuth = true;
};
# Enable udev rules for gnupg smart cards
hardware.gpgSmartcards.enable = true;
}