nixos-config/user/gpg.nix
Leonardo Eugênio c329928582 minor
2022-08-12 09:23:40 -03:00

39 lines
947 B
Nix

{ config, pkgs, lib, ... }: {
config = {
services.gpg-agent = {
enable = true;
defaultCacheTtl = 604800;
maxCacheTtl = 604800;
pinentryFlavor = "gtk2";
extraConfig = ''
allow-preset-passphrase
'';
};
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 = {
OnBootSec = "0";
OnUnitActiveSec = "30";
Unit = "gpg_unlock.service";
};
};
};
};
}