3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/programs/thefuck.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1,011 B
Nix
Raw Normal View History

2017-06-14 09:57:38 +01:00
{ config, pkgs, lib, ... }:
with lib;
let
prg = config.programs;
cfg = prg.thefuck;
bashAndZshInitScript = ''
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
'';
fishInitScript = ''
${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias} | source
'';
2017-06-14 09:57:38 +01:00
in
{
options = {
programs.thefuck = {
enable = mkEnableOption (lib.mdDoc "thefuck");
2017-06-14 09:57:38 +01:00
alias = mkOption {
default = "fuck";
type = types.str;
2017-06-14 09:57:38 +01:00
description = lib.mdDoc ''
2017-06-14 09:57:38 +01:00
`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 = bashAndZshInitScript;
programs.zsh.interactiveShellInit = mkIf prg.zsh.enable bashAndZshInitScript;
programs.fish.interactiveShellInit = mkIf prg.fish.enable fishInitScript;
2017-06-14 09:57:38 +01:00
};
}