From 29a940d8c2b8f1469f6e7fed477e378bbba84b03 Mon Sep 17 00:00:00 2001 From: Matt Wittmann Date: Sat, 9 Mar 2024 09:17:58 -0800 Subject: [PATCH] bat: handle existing cache in activation script Run `bat cache --build` in an empty directory to work around failure when ~/cache exists. --- modules/programs/bat.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/programs/bat.nix b/modules/programs/bat.nix index 99813e956..bf8040d14 100644 --- a/modules/programs/bat.nix +++ b/modules/programs/bat.nix @@ -159,10 +159,14 @@ 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 package} cache --build ) '';