add gpg auto-unlock
This commit is contained in:
parent
a8a8be5a59
commit
c5e919a2dc
4 changed files with 75 additions and 0 deletions
42
user/gpg.nix
Normal file
42
user/gpg.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ 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 = {
|
||||
OnBootSec = "30";
|
||||
OnUnitActiveSec = "30";
|
||||
Unit = "gpg_unlock.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue