1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

keychain: add fish shell integration

The shell command is added in the interactiveShellInit, as it is the
equivalent of initExtra in bash or zsh.
This commit is contained in:
Julien Tanguy 2019-12-27 10:56:47 +01:00
parent 8d14ffbe88
commit 5992c1b469

View file

@ -10,9 +10,7 @@ let
++ optional (cfg.agents != []) "--agents ${concatStringsSep "," cfg.agents}"
++ optional (cfg.inheritType != null) "--inherit ${cfg.inheritType}";
shellCommand = ''
eval "$(${cfg.package}/bin/keychain --eval ${concatStringsSep " " flags} ${concatStringsSep " " cfg.keys})"
'';
shellCommand = "${cfg.package}/bin/keychain --eval ${concatStringsSep " " flags} ${concatStringsSep " " cfg.keys}";
in
@ -71,6 +69,14 @@ in
'';
};
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Fish integration.
'';
};
enableZshIntegration = mkOption {
default = true;
type = types.bool;
@ -82,7 +88,14 @@ in
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration shellCommand;
programs.zsh.initExtra = mkIf cfg.enableZshIntegration shellCommand;
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval "$(${shellCommand})"
'';
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
eval (${shellCommand})
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${shellCommand})"
'';
};
}