2017-06-14 08:57:38 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2017-07-23 07:22:33 +00:00
|
|
|
prg = config.programs;
|
|
|
|
cfg = prg.thefuck;
|
|
|
|
|
|
|
|
initScript = ''
|
|
|
|
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
|
|
|
|
'';
|
2017-06-14 08:57:38 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.thefuck = {
|
|
|
|
enable = mkEnableOption "thefuck";
|
|
|
|
|
|
|
|
alias = mkOption {
|
|
|
|
default = "fuck";
|
|
|
|
type = types.string;
|
|
|
|
|
|
|
|
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 ];
|
2017-07-23 07:22:33 +00:00
|
|
|
|
2018-10-03 00:11:17 +00:00
|
|
|
programs.bash.interactiveShellInit = initScript;
|
2018-06-21 23:32:11 +00:00
|
|
|
programs.zsh.interactiveShellInit = mkIf prg.zsh.enable initScript;
|
|
|
|
programs.fish.interactiveShellInit = mkIf prg.fish.enable ''
|
2017-07-23 07:22:33 +00:00
|
|
|
${pkgs.thefuck}/bin/thefuck --alias | source
|
2017-06-14 08:57:38 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|