From b02843e22991cfd89590f2bc410b84e217580135 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sat, 8 Jun 2024 13:35:30 +0800 Subject: [PATCH] gpg-agent: use $TTY for zsh --- modules/services/gpg-agent.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index cce5ac19..adfcdbe7 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -13,11 +13,16 @@ let ${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null ''; - gpgInitStr = '' + gpgBashInitStr = '' GPG_TTY="$(tty)" export GPG_TTY '' + optionalString cfg.enableSshSupport gpgSshSupportStr; + gpgZshInitStr = '' + GPG_TTY="$TTY" + export GPG_TTY + '' + optionalString cfg.enableSshSupport gpgSshSupportStr; + gpgFishInitStr = '' set -gx GPG_TTY (tty) '' + optionalString cfg.enableSshSupport gpgSshSupportStr; @@ -256,8 +261,8 @@ in { fi ''; - programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr; - programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr; + programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgBashInitStr; + programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgZshInitStr; programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration gpgFishInitStr;