helm/modules/shell/gnupg.nix
Henrik Lissner 0ec23ed5f0
Refactor gnupg+pinentry installation
Ensure pinentry-gtk-2 is used so we can theme its prompt, and ensure
that gpg respects XDG conventions.
2019-12-04 00:03:31 -05:00

33 lines
660 B
Nix

{ config, lib, pkgs, ... }:
{
environment = {
extraInit = ''
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
if [ ! -d "$GNUPGHOME" ]; then
mkdir -p "$GNUPGHOME" -m 700
fi
'';
systemPackages = with pkgs; [
gnupg
pinentry
];
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
systemd.user.services.gpg-agent.serviceConfig.ExecStart = [
"" ''
${pkgs.gnupg}/bin/gpg-agent \
--supervised \
--allow-emacs-pinentry \
--default-cache-ttl 1200 \
--pinentry-program ${pkgs.pinentry}/bin/pinentry-gtk-2
''
];
}