nixpkgs/nixos/modules/programs/thefuck.nix

40 lines
919 B
Nix
Raw Normal View History

2017-06-14 10:57:38 +02:00
{ config, pkgs, lib, ... }:
with lib;
let
prg = config.programs;
cfg = prg.thefuck;
initScript = ''
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
'';
2017-06-14 10:57:38 +02:00
in
{
options = {
programs.thefuck = {
enable = mkEnableOption "thefuck";
alias = mkOption {
default = "fuck";
type = types.str;
2017-06-14 10:57:38 +02:00
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
2017-06-14 10:57:38 +02:00
'';
};
}