fork/home-manager
git clone https://git.julia.blue/fork/home-manager
a4817894
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4let 5 6cfg = config . programs . mcfly ; 7 8in { 9meta . maintainers = [ ]; 10 11imports = [ 12( mkChangedOptionModule # \ 13[ "programs" "mcfly" "enableFuzzySearch" ] # \ 14[ "programs" "mcfly" "fuzzySearchFactor" ] # \ 15( config : 16let 17value = 18getAttrFromPath [ "programs" "mcfly" "enableFuzzySearch" ] config ; 19in if value then 2 else 0 )) 20]; 21 22options . programs . mcfly = { 23enable = mkEnableOption "mcfly" ; 24 25keyScheme = mkOption { 26type = types . enum [ "emacs" "vim" ]; 27default = "emacs" ; 28description = '' 29Key scheme to use. 30'' ; 31}; 32 33enableLightTheme = mkOption { 34default = false ; 35type = types . bool ; 36description = '' 37Whether to enable light mode theme. 38'' ; 39}; 40 41fuzzySearchFactor = mkOption { 42default = 0 ; 43type = types . ints . unsigned ; 44description = '' 45Whether to enable fuzzy searching. 460 is off; higher numbers weight toward shorter matches. 47Values in the 2-5 range get good results so far. 48'' ; 49}; 50 51enableBashIntegration = mkOption { 52default = true ; 53type = types . bool ; 54description = '' 55Whether to enable Bash integration. 56'' ; 57}; 58 59enableZshIntegration = mkOption { 60default = true ; 61type = types . bool ; 62description = '' 63Whether to enable Zsh integration. 64'' ; 65}; 66 67enableFishIntegration = mkOption { 68default = true ; 69type = types . bool ; 70description = '' 71Whether to enable Fish integration. 72'' ; 73}; 74}; 75 76config = mkIf cfg . enable ( mkMerge [ 77{ 78home . packages = [ pkgs . mcfly ]; 79 80programs . bash . initExtra = mkIf cfg . enableBashIntegration '' 81eval "$( ${ pkgs . mcfly } /bin/mcfly init bash)" 82'' ; 83 84programs . zsh . initExtra = mkIf cfg . enableZshIntegration '' 85eval "$( ${ pkgs . mcfly } /bin/mcfly init zsh)" 86'' ; 87 88programs . fish . shellInit = mkIf cfg . enableFishIntegration '' 89${ pkgs . mcfly } /bin/mcfly init fish | source 90'' ; 91 92home . sessionVariables . MCFLY_KEY_SCHEME = cfg . keyScheme ; 93} 94 95( mkIf cfg . enableLightTheme { home . sessionVariables . MCFLY_LIGHT = "TRUE" ; }) 96 97( mkIf ( cfg . fuzzySearchFactor > 0 ) { 98home . sessionVariables . MCFLY_FUZZY = cfg . fuzzySearchFactor ; 99}) 100]); 101}