diff --git a/modules/programs/thefuck.nix b/modules/programs/thefuck.nix index 2cad4c33..ab56ea01 100644 --- a/modules/programs/thefuck.nix +++ b/modules/programs/thefuck.nix @@ -32,6 +32,14 @@ with lib; Whether to enable Zsh integration. ''; }; + + enableNushellIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Nushell integration. + ''; + }; }; config = let @@ -66,5 +74,11 @@ with lib; }; programs.zsh.initExtra = mkIf cfg.enableZshIntegration shEvalCmd; + + programs.nushell = mkIf cfg.enableNushellIntegration { + extraConfig = '' + alias fuck = ${cfg.package}/bin/thefuck $"(history | last 1 | get command | get 0)" + ''; + }; }; } diff --git a/tests/modules/programs/thefuck/integration-disabled.nix b/tests/modules/programs/thefuck/integration-disabled.nix index 9a55efac..45696359 100644 --- a/tests/modules/programs/thefuck/integration-disabled.nix +++ b/tests/modules/programs/thefuck/integration-disabled.nix @@ -6,8 +6,10 @@ thefuck.enableBashIntegration = false; thefuck.enableFishIntegration = false; thefuck.enableZshIntegration = false; + thefuck.enableNushellIntegration = false; bash.enable = true; zsh.enable = true; + nushell.enable = true; }; test.stubs.thefuck = { }; @@ -16,5 +18,6 @@ assertFileNotRegex home-files/.bashrc '@thefuck@/bin/thefuck' assertPathNotExists home-files/.config/fish/functions/fuck.fish assertFileNotRegex home-files/.zshrc '@thefuck@/bin/thefuck' + assertFileNotRegex home-files/.config/nushell/config.nu '@thefuck@/bin/thefuck' ''; } diff --git a/tests/modules/programs/thefuck/integration-enabled.nix b/tests/modules/programs/thefuck/integration-enabled.nix index 79cadaf8..54d6b794 100644 --- a/tests/modules/programs/thefuck/integration-enabled.nix +++ b/tests/modules/programs/thefuck/integration-enabled.nix @@ -6,6 +6,7 @@ bash.enable = true; fish.enable = true; zsh.enable = true; + nushell.enable = true; }; test.stubs.thefuck = { }; @@ -33,5 +34,10 @@ assertFileContains \ home-files/.zshrc \ 'eval "$(@thefuck@/bin/thefuck '"'"'--alias'"'"')"' + + assertFileExists home-files/.config/nushell/config.nu + assertFileContains \ + home-files/.config/nushell/config.nu \ + 'alias fuck = @thefuck@/bin/thefuck $"(history | last 1 | get command | get 0)"' ''; }