fork/home-manager
git clone https://git.julia.blue/fork/home-manager
0962772e
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4let 5cfg = config . programs . zsh . antidote ; 6 7zPluginStr = ( pluginNames : 8optionalString ( pluginNames != [ ]) " ${ concatStrings ( map ( name : '' 9${ name } 10'' ) pluginNames )} " ); 11 12parseHashId = path : 13elemAt ( builtins . match "/nix/store/([a-zA-Z0-9]+)-.*" path ) 0 ; 14in { 15meta . maintainers = [ maintainers . hitsmaxft ]; 16 17options . programs . zsh . antidote = { 18enable = mkEnableOption "antidote - a zsh plugin manager" ; 19 20plugins = mkOption { 21type = types . listOf types . str ; 22default = [ ]; 23example = [ "zsh-users/zsh-autosuggestions" ]; 24description = "List of antidote plugins." ; 25}; 26 27useFriendlyNames = mkEnableOption "friendly names" ; 28 29package = mkPackageOption pkgs "antidote" { }; 30}; 31 32config = mkIf cfg . enable { 33home . packages = [ cfg . package ]; 34programs . zsh . initExtraBeforeCompInit = let 35configFiles = pkgs . runCommand "hm_antidote-files" { } '' 36echo " ${ zPluginStr cfg . plugins } " > $ out 37'' ; 38hashId = parseHashId " ${ configFiles } " ; 39in '' 40## home-manager/antidote begin : 41source ${ cfg . package } /share/antidote/antidote.zsh 42${ optionalString cfg . useFriendlyNames 43"zstyle ':antidote:bundle' use-friendly-names 'yes'" } 44 45bundlefile= ${ configFiles } 46zstyle ':antidote:bundle' file $bundlefile 47staticfile=/tmp/tmp_hm_zsh_plugins.zsh- ${ hashId } 48zstyle ':antidote:static' file $staticfile 49 50antidote load $bundlefile $staticfile 51 52## home-manager/antidote end 53'' ; 54}; 55}