2020-03-28 22:48:43 -07:00
|
|
|
{ config, options, lib, pkgs, ... }:
|
2019-08-06 10:56:54 -07:00
|
|
|
|
2020-03-28 22:48:43 -07:00
|
|
|
with lib;
|
2020-10-01 15:46:04 -07:00
|
|
|
with lib.my;
|
|
|
|
let cfg = config.modules.shell.gnupg;
|
2020-03-28 22:48:43 -07:00
|
|
|
in {
|
2020-10-01 15:46:04 -07:00
|
|
|
options.modules.shell.gnupg = with types; {
|
|
|
|
enable = mkBoolOpt false;
|
|
|
|
cacheTTL = mkOpt int 3600; # 1hr
|
2019-12-03 20:56:48 -08:00
|
|
|
};
|
2019-08-06 10:56:54 -07:00
|
|
|
|
2020-10-01 15:46:04 -07:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg";
|
2020-04-05 22:57:44 -07:00
|
|
|
|
2020-04-27 16:20:50 -07:00
|
|
|
programs.gnupg.agent.enable = true;
|
2020-10-01 15:46:04 -07:00
|
|
|
|
|
|
|
user.packages = [ pkgs.tomb ];
|
|
|
|
|
|
|
|
# HACK Without this config file you get "No pinentry program" on 20.03.
|
|
|
|
# programs.gnupg.agent.pinentryFlavor doesn't appear to work, and this
|
|
|
|
# is cleaner than overriding the systemd unit.
|
|
|
|
home.configFile."gnupg/gpg-agent.conf" = {
|
|
|
|
text = ''
|
|
|
|
default-cache-ttl ${toString cfg.cacheTTL}
|
|
|
|
pinentry-program ${pkgs.pinentry.gtk2}/bin/pinentry
|
|
|
|
'';
|
|
|
|
};
|
2020-03-28 22:48:43 -07:00
|
|
|
};
|
2019-08-06 10:56:54 -07:00
|
|
|
}
|