helm/modules/shell/gnupg.nix

30 lines
807 B
Nix
Raw Normal View History

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;
with lib.my;
let cfg = config.modules.shell.gnupg;
2020-03-28 22:48:43 -07:00
in {
options.modules.shell.gnupg = with types; {
enable = mkBoolOpt false;
cacheTTL = mkOpt int 3600; # 1hr
};
2019-08-06 10:56:54 -07:00
config = mkIf cfg.enable {
environment.variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg";
2020-04-27 16:20:50 -07:00
programs.gnupg.agent.enable = true;
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
}