dotfiles.nix/nixos/common/optional/key.nix

29 lines
704 B
Nix
Raw Normal View History

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