nix-config/home/gpg/default.nix

37 lines
761 B
Nix
Raw Normal View History

2021-03-13 01:01:29 +01:00
{ config, lib, ... }:
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 = mkOption {
type = types.str;
default = "tty";
example = "gtk2";
description = "Which pinentry interface to use";
};
};
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
2021-04-07 19:40:11 +02:00
pinentryFlavor = 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";
};
};
}