From 9add6bdfc8eff26a0ecbd9efbb74f9397dafa89c Mon Sep 17 00:00:00 2001 From: Luflosi Date: Sun, 1 May 2022 17:54:31 +0200 Subject: [PATCH 1/2] nixos/thefuck: fix programs.thefuck.alias for fish This option was previously ignored when using fish as the shell. --- nixos/modules/programs/thefuck.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/programs/thefuck.nix b/nixos/modules/programs/thefuck.nix index b909916158d..fa5f8290c62 100644 --- a/nixos/modules/programs/thefuck.nix +++ b/nixos/modules/programs/thefuck.nix @@ -33,7 +33,7 @@ in programs.bash.interactiveShellInit = initScript; programs.zsh.interactiveShellInit = mkIf prg.zsh.enable initScript; programs.fish.interactiveShellInit = mkIf prg.fish.enable '' - ${pkgs.thefuck}/bin/thefuck --alias | source + ${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias} | source ''; }; } From 536a78ecc92688f186d44c8022054ff15de190db Mon Sep 17 00:00:00 2001 From: Luflosi Date: Sun, 1 May 2022 18:00:18 +0200 Subject: [PATCH 2/2] nixos/thefuck: rename variable and move fishInitScript into its own variable Renaming the variable from `initScript` to `bashAndZshInitScript` makes it clearer, what it is actually used for. Moving the fish init script right below the other call to `thefuck --alias` makes it more obvious, when one of them is different in some important way. --- nixos/modules/programs/thefuck.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/nixos/modules/programs/thefuck.nix b/nixos/modules/programs/thefuck.nix index fa5f8290c62..18d09e26866 100644 --- a/nixos/modules/programs/thefuck.nix +++ b/nixos/modules/programs/thefuck.nix @@ -6,9 +6,12 @@ let prg = config.programs; cfg = prg.thefuck; - initScript = '' + bashAndZshInitScript = '' eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias}) ''; + fishInitScript = '' + ${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias} | source + ''; in { options = { @@ -30,10 +33,8 @@ in config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ thefuck ]; - programs.bash.interactiveShellInit = initScript; - programs.zsh.interactiveShellInit = mkIf prg.zsh.enable initScript; - programs.fish.interactiveShellInit = mkIf prg.fish.enable '' - ${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias} | source - ''; + programs.bash.interactiveShellInit = bashAndZshInitScript; + programs.zsh.interactiveShellInit = mkIf prg.zsh.enable bashAndZshInitScript; + programs.fish.interactiveShellInit = mkIf prg.fish.enable fishInitScript; }; }