diff options
Diffstat (limited to 'nixos/modules/programs/thefuck.nix')
-rw-r--r-- | nixos/modules/programs/thefuck.nix | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/nixos/modules/programs/thefuck.nix b/nixos/modules/programs/thefuck.nix new file mode 100644 index 00000000000..b909916158d --- /dev/null +++ b/nixos/modules/programs/thefuck.nix @@ -0,0 +1,39 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + prg = config.programs; + cfg = prg.thefuck; + + initScript = '' + eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias}) + ''; +in + { + options = { + programs.thefuck = { + enable = mkEnableOption "thefuck"; + + alias = mkOption { + default = "fuck"; + type = types.str; + + description = '' + `thefuck` needs an alias to be configured. + The default value is `fuck`, but you can use anything else as well. + ''; + }; + }; + }; + + 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 | source + ''; + }; + } |