nix-config/modules/home/gpg/default.nix

32 lines
691 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2021-03-13 01:01:29 +01:00
let
cfg = config.my.home.gpg;
in
{
2021-04-07 19:40:11 +02:00
options.my.home.gpg = with lib; {
enable = my.mkDisableOption "gpg configuration";
pinentry = mkPackageOption pkgs "pinentry" { default = [ "pinentry-tty" ]; };
};
2021-03-13 01:01:29 +01:00
config = lib.mkIf cfg.enable {
programs.gpg = {
enable = true;
};
services.gpg-agent = {
enable = true;
enableSshSupport = true; # One agent to rule them all
pinentryPackage = cfg.pinentry;
2021-03-13 01:01:29 +01:00
extraConfig = ''
allow-loopback-pinentry
'';
};
2023-03-24 12:18:08 +01:00
home.shellAliases = {
# Sometime `gpg-agent` errors out...
reset-agent = "gpg-connect-agent updatestartuptty /bye";
};
};
}