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.
This commit is contained in:
crazymanjinn 2022-04-30 20:38:36 -04:00 committed by GitHub
parent f8b51be714
commit df6010551d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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