fork/home-manager
git clone https://git.julia.blue/fork/home-manager
fc2a8842
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . k9s ; 8yamlFormat = pkgs . formats . yaml { }; 9 10in { 11meta . maintainers = with maintainers ; [ katexochen liyangau ]; 12 13options . programs . k9s = { 14enable = 15mkEnableOption "k9s - Kubernetes CLI To Manage Your Clusters In Style" ; 16 17package = mkPackageOption pkgs "k9s" { }; 18 19settings = mkOption { 20type = yamlFormat . type ; 21default = { }; 22description = '' 23Configuration written to 24{file}`$XDG_CONFIG_HOME/k9s/config.yml`. See 25<https://k9scli.io/topics/config/> 26for supported values. 27'' ; 28example = literalExpression '' 29k9s = { 30refreshRate = 2; 31}; 32'' ; 33}; 34 35skin = mkOption { 36type = yamlFormat . type ; 37default = { }; 38description = '' 39Skin written to 40{file}`$XDG_CONFIG_HOME/k9s/skin.yml`. See 41<https://k9scli.io/topics/skins/> 42for supported values. 43'' ; 44example = literalExpression '' 45k9s = { 46body = { 47fgColor = "dodgerblue"; 48}; 49}; 50'' ; 51}; 52 53hotkey = mkOption { 54type = yamlFormat . type ; 55default = { }; 56description = '' 57hotkeys written to 58{file}`$XDG_CONFIG_HOME/k9s/hotkey.yml`. See 59<https://k9scli.io/topics/hotkeys/> 60for supported values. 61'' ; 62example = literalExpression '' 63hotkey = { 64# Make sure this is camel case 65hotKey = { 66shift-0 = { 67shortCut = "Shift-0"; 68description = "Viewing pods"; 69command = "pods"; 70}; 71}; 72}; 73'' ; 74}; 75}; 76 77config = mkIf cfg . enable { 78home . packages = [ cfg . package ]; 79 80xdg . configFile . "k9s/config.yml" = mkIf ( cfg . settings != { }) { 81source = yamlFormat . generate "k9s-config" cfg . settings ; 82}; 83 84xdg . configFile . "k9s/skin.yml" = mkIf ( cfg . skin != { }) { 85source = yamlFormat . generate "k9s-skin" cfg . skin ; 86}; 87 88xdg . configFile . "k9s/hotkey.yml" = mkIf ( cfg . hotkey != { }) { 89source = yamlFormat . generate "k9s-hotkey" cfg . hotkey ; 90}; 91}; 92}