home-manager/modules/programs/thefuck.nix
2023-10-04 09:39:23 +02:00

42 lines
982 B
Nix

{ 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)"
'';
};
}