From fb8b813438eb1f3760dd5e5336f438d63b4e7e01 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Mon, 3 Jun 2024 09:10:40 +0200 Subject: [PATCH] bat: skip activation script if not needed --- modules/programs/bat.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/programs/bat.nix b/modules/programs/bat.nix index 5d09145af..0b8260d16 100644 --- a/modules/programs/bat.nix +++ b/modules/programs/bat.nix @@ -162,14 +162,15 @@ in { # NOTE: run `bat cache --build` in an empty directory to work # around failure when ~/cache exists # https://github.com/sharkdp/bat/issues/1726 - home.activation.batCache = hm.dag.entryAfter [ "linkGeneration" ] '' - ( - export XDG_CACHE_HOME=${escapeShellArg config.xdg.cacheHome} - verboseEcho "Rebuilding bat theme cache" - cd "${pkgs.emptyDirectory}" - run ${lib.getExe cfg.package} cache --build - ) - ''; + home.activation.batCache = mkIf (cfg.syntaxes != { } || cfg.themes != { }) + (hm.dag.entryAfter [ "linkGeneration" ] '' + ( + export XDG_CACHE_HOME=${escapeShellArg config.xdg.cacheHome} + verboseEcho "Rebuilding bat theme cache" + cd "${pkgs.emptyDirectory}" + run ${lib.getExe cfg.package} cache --build + ) + ''); } ]); }