at 17.09-beta 887 B view raw
1{ config, pkgs, lib, ... }: 2 3with lib; 4 5let 6 prg = config.programs; 7 cfg = prg.thefuck; 8 9 initScript = '' 10 eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias}) 11 ''; 12in 13 { 14 options = { 15 programs.thefuck = { 16 enable = mkEnableOption "thefuck"; 17 18 alias = mkOption { 19 default = "fuck"; 20 type = types.string; 21 22 description = '' 23 `thefuck` needs an alias to be configured. 24 The default value is `fuck`, but you can use anything else as well. 25 ''; 26 }; 27 }; 28 }; 29 30 config = mkIf cfg.enable { 31 environment.systemPackages = with pkgs; [ thefuck ]; 32 environment.shellInit = initScript; 33 34 programs.zsh.shellInit = mkIf prg.zsh.enable initScript; 35 programs.fish.shellInit = mkIf prg.fish.enable '' 36 ${pkgs.thefuck}/bin/thefuck --alias | source 37 ''; 38 }; 39 }