From d93d56ab8c1c6aa575854a79b9d2f69d491db7d0 Mon Sep 17 00:00:00 2001 From: crazymanjinn Date: Mon, 2 May 2022 15:25:40 -0400 Subject: [PATCH] gpg-agent: make shell integrations optional (#2927) (#2930) In esoteric setups, automatically setting GPG_TTY to current tty is not desired on every shell startup. This change adds configuration options to allow user to disable that if desired. (cherry picked from commit df6010551daa826217939641ab805053f0890239) --- modules/services/gpg-agent.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index 785f11141..5270af394 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -170,6 +170,18 @@ in now. ''; }; + + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; }; }; @@ -206,9 +218,9 @@ in fi ''; - programs.bash.initExtra = gpgInitStr; - programs.zsh.initExtra = gpgInitStr; - programs.fish.interactiveShellInit = '' + programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr; + programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr; + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' set -gx GPG_TTY (tty) ''; }