mirror of
https://github.com/nix-community/home-manager
synced 2024-11-04 18:29:45 +01:00
bat: rebuild caches during activation
Without this, themes configured through Home Manager are not found at runtime.
This commit is contained in:
parent
cd5723734a
commit
aa03c8a429
1 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.bat;
|
cfg = config.programs.bat;
|
||||||
|
|
||||||
|
package = pkgs.bat;
|
||||||
|
|
||||||
toConfigFile = generators.toKeyValue {
|
toConfigFile = generators.toKeyValue {
|
||||||
mkKeyValue = k: v: "--${k}=${lib.escapeShellArg v}";
|
mkKeyValue = k: v: "--${k}=${lib.escapeShellArg v}";
|
||||||
listsAsDuplicateKeys = true;
|
listsAsDuplicateKeys = true;
|
||||||
|
@ -61,12 +63,17 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ pkgs.bat ] ++ cfg.extraPackages;
|
home.packages = [ package ] ++ cfg.extraPackages;
|
||||||
|
|
||||||
xdg.configFile = mkMerge ([{
|
xdg.configFile = mkMerge ([{
|
||||||
"bat/config" =
|
"bat/config" =
|
||||||
mkIf (cfg.config != { }) { text = toConfigFile cfg.config; };
|
mkIf (cfg.config != { }) { text = toConfigFile cfg.config; };
|
||||||
}] ++ flip mapAttrsToList cfg.themes
|
}] ++ flip mapAttrsToList cfg.themes
|
||||||
(name: body: { "bat/themes/${name}.tmTheme" = { text = body; }; }));
|
(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
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue