Skip to content

Commit

Permalink
fix(home-manager): dont declare xdg.configFile when btop isn't enabled (
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo authored Jul 13, 2023
1 parent 2558a75 commit 9616836
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions modules/home-manager/btop.nix
Original file line number Diff line number Diff line change
@@ -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.configFile."btop${themePath}".source = with lib;
mkIf cfg.enable theme;
config =
{
xdg.enable = with lib; mkIf cfg.enable (mkForce true);

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;
});
}

0 comments on commit 9616836

Please sign in to comment.