1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

keychain: fix edge-cases in nushell integration

- If the parse does not match/returns an empty list, transpose does
  not transform it into a record and thus load-env fails.

- The parsing assumes keychain to emit bash-style completions, so set
  SHELL=bash to ensure keychain output is in the expected format.

PR #4459
This commit is contained in:
jakob 2023-09-14 14:13:08 +02:00 committed by Robert Helgesson
parent dd88dbc694
commit 0f4e5b4999
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -117,7 +117,10 @@ in {
eval "$(SHELL=zsh ${shellCommand})" eval "$(SHELL=zsh ${shellCommand})"
''; '';
programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration '' programs.nushell.extraConfig = mkIf cfg.enableNushellIntegration ''
${shellCommand} | parse -r '(\w+)=(.*); export \1' | transpose -ird | load-env let keychain_shell_command = (SHELL=bash ${shellCommand}| parse -r '(\w+)=(.*); export \1' | transpose -ird)
if not ($keychain_shell_command|is-empty) {
$keychain_shell_command | load-env
}
''; '';
xsession.initExtra = mkIf cfg.enableXsessionIntegration '' xsession.initExtra = mkIf cfg.enableXsessionIntegration ''
eval "$(SHELL=bash ${shellCommand})" eval "$(SHELL=bash ${shellCommand})"