thefuck: add module
This commit is contained in:
parent
b0e0d82696
commit
2874c6fce6
|
@ -1266,6 +1266,13 @@ in
|
||||||
A new module is available: 'programs.zsh.zsh-abbr'
|
A new module is available: 'programs.zsh.zsh-abbr'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2023-10-04T06:44:15+00:00";
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'programs.thefuck'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,7 @@ let
|
||||||
./programs/terminator.nix
|
./programs/terminator.nix
|
||||||
./programs/termite.nix
|
./programs/termite.nix
|
||||||
./programs/texlive.nix
|
./programs/texlive.nix
|
||||||
|
./programs/thefuck.nix
|
||||||
./programs/thunderbird.nix
|
./programs/thunderbird.nix
|
||||||
./programs/timidity.nix
|
./programs/timidity.nix
|
||||||
./programs/tint2.nix
|
./programs/tint2.nix
|
||||||
|
|
41
modules/programs/thefuck.nix
Normal file
41
modules/programs/thefuck.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
with lib;
|
||||||
|
let cfg = config.programs.thefuck;
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ hm.maintainers.ilaumjd ];
|
||||||
|
|
||||||
|
options.programs.thefuck = {
|
||||||
|
enable = mkEnableOption
|
||||||
|
"thefuck - magnificent app that corrects your previous console command";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "thefuck" { };
|
||||||
|
|
||||||
|
enableBashIntegration = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to enable Bash integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
enableZshIntegration = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to enable Zsh integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
|
eval "$(${cfg.package}/bin/thefuck --alias)"
|
||||||
|
'';
|
||||||
|
|
||||||
|
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||||
|
eval "$(${cfg.package}/bin/thefuck --alias)"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -139,6 +139,7 @@ import nmt {
|
||||||
./modules/programs/starship
|
./modules/programs/starship
|
||||||
./modules/programs/taskwarrior
|
./modules/programs/taskwarrior
|
||||||
./modules/programs/texlive
|
./modules/programs/texlive
|
||||||
|
./modules/programs/thefuck
|
||||||
./modules/programs/tmate
|
./modules/programs/tmate
|
||||||
./modules/programs/tmux
|
./modules/programs/tmux
|
||||||
./modules/programs/topgrade
|
./modules/programs/topgrade
|
||||||
|
|
4
tests/modules/programs/thefuck/default.nix
Normal file
4
tests/modules/programs/thefuck/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
thefuck-integration-enabled = ./integration-enabled.nix;
|
||||||
|
thefuck-integration-disabled = ./integration-disabled.nix;
|
||||||
|
}
|
18
tests/modules/programs/thefuck/integration-disabled.nix
Normal file
18
tests/modules/programs/thefuck/integration-disabled.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs = {
|
||||||
|
thefuck.enable = true;
|
||||||
|
thefuck.enableBashIntegration = false;
|
||||||
|
thefuck.enableZshIntegration = false;
|
||||||
|
bash.enable = true;
|
||||||
|
zsh.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs.thefuck = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileNotRegex home-files/.bashrc '@thefuck@/bin/thefuck'
|
||||||
|
assertFileNotRegex home-files/.zshrc '@thefuck@/bin/thefuck'
|
||||||
|
'';
|
||||||
|
}
|
23
tests/modules/programs/thefuck/integration-enabled.nix
Normal file
23
tests/modules/programs/thefuck/integration-enabled.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs = {
|
||||||
|
thefuck.enable = true;
|
||||||
|
bash.enable = true;
|
||||||
|
zsh.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs.thefuck = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.bashrc
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.bashrc \
|
||||||
|
'eval "$(@thefuck@/bin/thefuck --alias)"'
|
||||||
|
|
||||||
|
assertFileExists home-files/.zshrc
|
||||||
|
assertFileContains \
|
||||||
|
home-files/.zshrc \
|
||||||
|
'eval "$(@thefuck@/bin/thefuck --alias)"'
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue