dotfiles/catppuccin/k9s/default.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

2023-02-10 07:46:37 +01:00
{
config,
lib,
options,
pkgs,
...
}:
with lib; let
global = config.catppuccin;
cfg = config.catppuccin.k9s;
2023-02-10 07:46:37 +01:00
fromYAML = f: let
jsonFile =
pkgs.runCommand "in.json"
{
nativeBuildInputs = [pkgs.gojq];
} ''
gojq --yaml-input < "${f}" > "$out"
'';
2023-02-10 07:46:37 +01:00
in
builtins.fromJSON (builtins.readFile jsonFile);
2023-02-10 07:46:37 +01:00
in {
options.catppuccin.k9s = {
enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enable catppuccin k9s theme";
};
theme = mkOption {
2023-02-10 07:46:37 +01:00
type = types.enum ["mocha" "macchiato" "frappe" "latte"];
default = global.defaultTheme;
description = "Choose a catppuccin k9s theme";
};
};
config = mkIf cfg.enable {
programs.k9s = {
enable = true;
skin = fromYAML (pkgs.fetchFromGitHub {
2023-02-10 07:46:37 +01:00
owner = "catppuccin";
repo = "k9s";
rev = "322598e19a4270298b08dc2765f74795e23a1615";
sha256 = "sha256-GrRCOwCgM8BFhY8TzO3/WDTUnGtqkhvlDWE//ox2GxI=";
}
+ /dist/${cfg.theme}.yml);
};
};
}