fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . btop ; 8 9finalConfig = let 10toKeyValue = generators . toKeyValue { 11mkKeyValue = generators . mkKeyValueDefault { 12mkValueString = v : 13with builtins ; 14if isBool v then 15( if v then "True" else "False" ) 16else if isString v then 17''" ${ v } "'' 18else 19toString v ; 20} " = " ; 21}; 22in '' 23${ toKeyValue cfg . settings } 24${ optionalString ( cfg . extraConfig != "" ) cfg . extraConfig } 25'' ; 26 27in { 28meta . maintainers = [ hm . maintainers . GaetanLepage ]; 29 30options . programs . btop = { 31enable = mkEnableOption "btop" ; 32 33package = mkPackageOption pkgs "btop" { }; 34 35settings = mkOption { 36type = with types ; attrsOf ( oneOf [ bool float int str ]); 37default = { }; 38example = { 39color_theme = "Default" ; 40theme_background = false ; 41}; 42description = '' 43Options to add to {file}`btop.conf` file. 44See <https://github.com/aristocratos/btop#configurability> 45for options. 46'' ; 47}; 48 49extraConfig = mkOption { 50type = types . lines ; 51default = "" ; 52description = '' 53Extra lines added to the {file}`btop.conf` file. 54'' ; 55}; 56}; 57 58config = mkIf cfg . enable { 59home . packages = [ cfg . package ]; 60 61xdg . configFile . "btop/btop.conf" = 62mkIf ( cfg . settings != { }) { text = finalConfig ; }; 63}; 64}