nixos-config/user/gpg.nix

43 lines
1 KiB
Nix
Raw Normal View History

2022-08-08 21:16:45 -03:00
{ config, pkgs, lib, ... }: {
config = {
services.gpg-agent = {
enable = true;
defaultCacheTtl = 604800;
maxCacheTtl = 604800;
pinentryFlavor = "gtk2";
extraConfig = ''
allow-preset-passphrase
allow-loopback-pinentry
pinentry-mode loopback
'';
};
systemd.user.services = {
gpg_unlock = {
Unit = {
Description = "Unlock gpg keyring";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs._gpg-unlock}/bin/_gpg-unlock";
};
};
};
systemd.user.timers = {
gpg_unlock = {
Unit = {
Description = "Unlock gpg keyring";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Timer = {
2022-08-08 22:00:45 -03:00
OnBootSec = "0";
2022-08-08 21:16:45 -03:00
OnUnitActiveSec = "30";
Unit = "gpg_unlock.service";
};
};
};
};
}