From 5992c1b469691eaa8aac46a5423260a730992349 Mon Sep 17 00:00:00 2001 From: Julien Tanguy Date: Fri, 27 Dec 2019 10:56:47 +0100 Subject: [PATCH] keychain: add fish shell integration The shell command is added in the interactiveShellInit, as it is the equivalent of initExtra in bash or zsh. --- modules/programs/keychain.nix | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/modules/programs/keychain.nix b/modules/programs/keychain.nix index 6dbf83a87..406f572ae 100644 --- a/modules/programs/keychain.nix +++ b/modules/programs/keychain.nix @@ -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})" + ''; }; }