fork/home-manager
git clone https://git.julia.blue/fork/home-manager
27d89b49
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . zsh . zplug ; 8 9pluginModule = types . submodule ({ config , ...} :{ 10options = { 11name = mkOption { 12type = types . str ; 13description = "The name of the plugin." ; 14}; 15 16tags = mkOption { 17type = types . listOf types . str ; 18default = [ ]; 19description = "The plugin tags." ; 20}; 21}; 22 23}); 24 25in { 26options . programs . zsh . zplug = { 27enable = mkEnableOption "zplug - a zsh plugin manager" ; 28 29plugins = mkOption { 30default = [ ]; 31type = types . listOf pluginModule ; 32description = "List of zplug plugins." ; 33}; 34 35zplugHome = mkOption { 36type = types . path ; 37default = " ${ config . home . homeDirectory } /.zplug" ; 38defaultText = "~/.zplug" ; 39apply = toString ; 40description = "Path to zplug home directory." ; 41}; 42}; 43 44config = mkIf cfg . enable { 45home . packages = [ pkgs . zplug ]; 46 47programs . zsh . initExtraBeforeCompInit = '' 48export ZPLUG_HOME= ${ cfg . zplugHome } 49 50source ${ pkgs . zplug } /share/zplug/init.zsh 51 52${ optionalString ( cfg . plugins != [ ]) '' 53${ concatStrings ( map ( plugin : '' 54zplug " ${ plugin . name } " ${ 55optionalString ( plugin . tags != [ ]) '' 56${ concatStrings ( map ( tag : ", ${ tag } " ) plugin . tags )} 57'' 58} 59'' ) cfg . plugins )} 60'' } 61 62if ! zplug check; then 63zplug install 64fi 65 66zplug load 67'' ; 68 69}; 70}