From 9616836d656f34178e2adac1bc2af95ad3952e50 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 13 Jul 2023 12:15:35 -0400 Subject: [PATCH] fix(home-manager): dont declare xdg.configFile when btop isn't enabled (#37) --- modules/home-manager/btop.nix | 37 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index db43092..0e67a12 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -1,25 +1,34 @@ -{ config, pkgs, lib, ... }: +{ 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; + theme = + pkgs.fetchFromGitHub + { + owner = "catppuccin"; + repo = "btop"; + rev = "7109eac2884e9ca1dae431c0d7b8bc2a7ce54e54"; + sha256 = "sha256-QoPPx4AzxJMYo/prqmWD/CM7e5vn/ueyx+XQ5+YfHF8="; + } + + themePath; in { options.programs.btop.catppuccin = lib.ctp.mkCatppuccinOpt "btop" config; # xdg is required for this to work - config.xdg.enable = with lib; mkIf cfg.enable (mkForce true); + 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}"}"; + programs.btop.settings.color_theme = with lib; + mkIf cfg.enable "${config.xdg.configHome + "/btop/${themePath}"}"; + } + // (lib.mkIf cfg.enable { + xdg.configFile."btop${themePath}".source = theme; + }); }