From df6010551daa826217939641ab805053f0890239 Mon Sep 17 00:00:00 2001 From: crazymanjinn Date: Sat, 30 Apr 2022 20:38:36 -0400 Subject: [PATCH] gpg-agent: make shell integrations optional (#2927) 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. --- 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 d4ccef3ec..21303ee8e 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -197,6 +197,18 @@ in { now. ''; }; + + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; }; }; @@ -224,9 +236,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) ''; }