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 df6010551d)
This commit is contained in:
crazymanjinn 2022-05-02 15:25:40 -04:00 committed by GitHub
parent d14adb99f3
commit d93d56ab8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
'';
}