From 25edfe9641184ef8b53ca3f69c28433e784fa4e1 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 15 Apr 2023 20:13:47 -0400 Subject: [PATCH] feat(home-manager): add support for btop (#20) --- modules/home-manager/btop.nix | 29 +++++++++++++++++++++++++++++ modules/home-manager/default.nix | 1 + 2 files changed, 30 insertions(+) create mode 100644 modules/home-manager/btop.nix diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix new file mode 100644 index 00000000..29d29948 --- /dev/null +++ b/modules/home-manager/btop.nix @@ -0,0 +1,29 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.programs.btop.catppuccin; + themePath = "/themes/catppuccin_${cfg.flavour}.theme"; + theme = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "btop"; + rev = "7109eac2884e9ca1dae431c0d7b8bc2a7ce54e54"; + sha256 = "sha256-QoPPx4AzxJMYo/prqmWD/CM7e5vn/ueyx+XQ5+YfHF8="; + } + themePath; +in { + options.programs.btop.catppuccin = with lib; { + enable = mkEnableOption "Catppuccin theme"; + flavour = mkOption { + type = types.enum [ "latte" "frappe" "macchiato" "mocha" ]; + default = config.catppuccin.flavour; + description = "Catppuccin flavour for btop"; + }; + }; + + # xdg is required for this to work + config.xdg.enable = with lib; mkIf cfg.enable (mkForce true); + + config.xdg.configFile."btop${themePath}".source = with lib; + mkIf cfg.enable theme; + + config.programs.btop.settings.color_theme = with lib; + mkIf cfg.enable "${config.xdg.configHome + "/btop/${themePath}"}"; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 437defd0..4d28a30c 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -3,6 +3,7 @@ ./alacritty.nix ./bat.nix ./bottom.nix + ./btop.nix ./kitty.nix ./starship.nix ./helix.nix