about summary refs log tree commit diff
path: root/modules/programs
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-03-25 15:45:41 +0100
committerProfpatsch <mail@profpatsch.de>2021-03-25 15:46:54 +0100
commit1e6e97836c5281b18929e43877025ff78b689e76 (patch)
treeb022180db1afbe7cdfc81477a20b4ef0fbc9989b /modules/programs
parent5d902840e46a3c7b9ceaaa6547ed7b417686eab9 (diff)
modules/programs/gnupg: allow extraConfig for gpg-agent.conf
Since we pass the config, the home directory config isn’t picked up
anymore, so I need to pass it via `extraConfig`.
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/gnupg/default.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/programs/gnupg/default.nix b/modules/programs/gnupg/default.nix
index e474289c..8aacfe03 100644
--- a/modules/programs/gnupg/default.nix
+++ b/modules/programs/gnupg/default.nix
@@ -76,6 +76,18 @@ in {
     agent = {
       enable = lib.mkEnableOption "support for the GnuPG agent";
 
+      extraConfig = lib.mkOption {
+        type = types.str;
+        default = "";
+        example = lib.literalExample ''
+          default-cache-ttl 34560000
+          default-cache-ttl-ssh 34560000
+          max-cache-ttl 34560000
+          max-cache-ttl-ssh 34560000
+        '';
+        description = "The content of gpg-agent.conf";
+      };
+
       pinentry.program = mkOption {
         type = types.path;
         default = "${pkgs.pinentry_gtk2}/bin/pinentry";
@@ -118,6 +130,7 @@ in {
 
         serviceConfig.ExecStart = let
           configFile = pkgs.writeText "gpg-agent.conf" ''
+            # module-defined config
             pinentry-program ${pinentryWrapper}
             ${if cfg.agent.scdaemon.enable
               then "scdaemon-program ${scdaemonRedirector}"
@@ -126,6 +139,9 @@ in {
               then "supervised"
               else "no-detach\ndaemon"}
             ${lib.optionalString cfg.agent.sshSupport "enable-ssh-support"}
+
+            # module user config
+            ${cfg.agent.extraConfig}
           '';
         in "${cfg.package}/bin/gpg-agent --options ${configFile}";