summary refs log tree commit diff
path: root/nixos/modules/programs/thefuck.nix
diff options
context:
space:
mode:
authorLuflosi <luflosi@luflosi.de>2022-05-01 18:00:18 +0200
committerLuflosi <luflosi@luflosi.de>2022-05-01 18:08:36 +0200
commit536a78ecc92688f186d44c8022054ff15de190db (patch)
treebca14b2db9eab40ac572d2809f24d49215fe186a /nixos/modules/programs/thefuck.nix
parent9add6bdfc8eff26a0ecbd9efbb74f9397dafa89c (diff)
downloadnixpkgs-536a78ecc92688f186d44c8022054ff15de190db.tar
nixpkgs-536a78ecc92688f186d44c8022054ff15de190db.tar.gz
nixpkgs-536a78ecc92688f186d44c8022054ff15de190db.tar.bz2
nixpkgs-536a78ecc92688f186d44c8022054ff15de190db.tar.lz
nixpkgs-536a78ecc92688f186d44c8022054ff15de190db.tar.xz
nixpkgs-536a78ecc92688f186d44c8022054ff15de190db.tar.zst
nixpkgs-536a78ecc92688f186d44c8022054ff15de190db.zip
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.
Diffstat (limited to 'nixos/modules/programs/thefuck.nix')
-rw-r--r--nixos/modules/programs/thefuck.nix13
1 files 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;
     };
   }