fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . matplotlib ; 8 9formatLine = o :n :v : 10let 11formatValue = v : 12if isBool v then ( if v then "True" else "False" ) else toString v ; 13in if isAttrs v then 14concatStringsSep "\n" ( mapAttrsToList ( formatLine " ${ o }${ n } ." ) v ) 15else 16( if v == "" then "" else " ${ o }${ n } : ${ formatValue v } " ); 17 18in { 19meta . maintainers = [ maintainers . rprospero ]; 20 21options . programs . matplotlib = { 22enable = mkEnableOption "matplotlib, a plotting library for python" ; 23 24config = mkOption { 25default = { }; 26type = types . attrsOf types . anything ; 27description = '' 28Add terms to the {file}`matplotlibrc` file to 29control the default matplotlib behavior. 30'' ; 31example = literalExpression '' 32{ 33backend = "Qt5Agg"; 34axes = { 35grid = true; 36facecolor = "black"; 37edgecolor = "FF9900"; 38}; 39grid.color = "FF9900"; 40} 41'' ; 42}; 43 44extraConfig = mkOption { 45type = types . lines ; 46default = "" ; 47description = '' 48Additional commands for matplotlib that will be added to the 49{file}`matplotlibrc` file. 50'' ; 51}; 52}; 53 54config = mkIf cfg . enable { 55xdg . configFile . "matplotlib/matplotlibrc" . text = concatStringsSep "\n" ([ ] 56++ mapAttrsToList ( formatLine "" ) cfg . config 57++ optional ( cfg . extraConfig != "" ) cfg . extraConfig ) + "\n" ; 58}; 59}