1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-28 04:39:48 +01:00

bat: rebuild caches during activation

Without this, themes configured through Home Manager are not found at
runtime.
This commit is contained in:
Bernardo Meurer 2023-04-18 11:57:55 -03:00 committed by Robert Helgesson
parent cd5723734a
commit aa03c8a429
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -6,6 +6,8 @@ let
cfg = config.programs.bat;
package = pkgs.bat;
toConfigFile = generators.toKeyValue {
mkKeyValue = k: v: "--${k}=${lib.escapeShellArg v}";
listsAsDuplicateKeys = true;
@ -61,12 +63,17 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.bat ] ++ cfg.extraPackages;
home.packages = [ package ] ++ cfg.extraPackages;
xdg.configFile = mkMerge ([{
"bat/config" =
mkIf (cfg.config != { }) { text = toConfigFile cfg.config; };
}] ++ flip mapAttrsToList cfg.themes
(name: body: { "bat/themes/${name}.tmTheme" = { text = body; }; }));
home.activation.batCache = hm.dag.entryAfter [ "linkGeneration" ] ''
$VERBOSE_ECHO "Rebuilding bat theme cache"
$DRY_RUN_CMD ${lib.getExe package} cache --build
'';
};
}