keychain: set SHELL correctly in bash and zsh

bash and zsh apparently handle command substitution slightly differently
than fish. in bash/zsh:

$ export FOO=x
$ FOO=y echo $(sh -c 'echo $FOO')
x

whereas in fish:

$ export FOO=x
$ FOO=y echo $(sh -c 'echo $FOO')
y

so we have to assign $SHELL within the substitution for bash and zsh.
This commit is contained in:
ash 2022-06-30 00:02:38 +01:00 committed by Robert Helgesson
parent 602f2ce59c
commit 241a375f49
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -100,13 +100,13 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
SHELL=bash eval "$(${shellCommand})"
eval "$(SHELL=bash ${shellCommand})"
'';
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
SHELL=fish eval (${shellCommand})
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
SHELL=zsh eval "$(${shellCommand})"
eval "$(SHELL=zsh ${shellCommand})"
'';
xsession.initExtra = mkIf cfg.enableXsessionIntegration ''
eval "$(${shellCommand})"