From 0bc81de9cca7058349bb3280dfac7bc1aad768f2 Mon Sep 17 00:00:00 2001 From: Gabe Dunn Date: Fri, 9 Aug 2024 10:07:21 -0600 Subject: [PATCH] gpg-agent: add quietShellIntegration option --- modules/services/gpg-agent.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index cce5ac191..eaf4c1e92 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -9,8 +9,10 @@ let homedir = config.programs.gpg.homedir; + gpgConnectAgentOpts = optionalString cfg.quietShellIntegration "--quiet"; + gpgSshSupportStr = '' - ${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null + ${gpgPkg}/bin/gpg-connect-agent ${gpgConnectAgentOpts} updatestartuptty /bye > /dev/null ''; gpgInitStr = '' @@ -25,7 +27,7 @@ let gpgNushellInitStr = '' $env.GPG_TTY = (tty) '' + optionalString cfg.enableSshSupport '' - ${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye | ignore + ${gpgPkg}/bin/gpg-connect-agent ${gpgConnectAgentOpts} updatestartuptty /bye | ignore $env.SSH_AUTH_SOCK = ($env.SSH_AUTH_SOCK? | default (${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)) ''; @@ -229,6 +231,14 @@ in { enableNushellIntegration = mkEnableOption "Nushell integration" // { default = true; }; + + quietShellIntegration = mkOption { + type = types.bool; + default = false; + description = '' + Whether to pass the `--quiet` flag to gpg-connect-agent. + ''; + }; }; };