bat: allow overriding package (#5301)
This commit is contained in:
parent
670d9ecc3e
commit
46833c3115
|
@ -6,8 +6,6 @@ let
|
||||||
|
|
||||||
cfg = config.programs.bat;
|
cfg = config.programs.bat;
|
||||||
|
|
||||||
package = pkgs.bat;
|
|
||||||
|
|
||||||
toConfigFile = attrs:
|
toConfigFile = attrs:
|
||||||
let
|
let
|
||||||
inherit (builtins) isBool attrNames;
|
inherit (builtins) isBool attrNames;
|
||||||
|
@ -52,6 +50,8 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "bat" { };
|
||||||
|
|
||||||
themes = mkOption {
|
themes = mkOption {
|
||||||
type = types.attrsOf (types.either types.lines (types.submodule {
|
type = types.attrsOf (types.either types.lines (types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -138,7 +138,7 @@ in {
|
||||||
''];
|
''];
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
home.packages = [ package ] ++ cfg.extraPackages;
|
home.packages = [ cfg.package ] ++ cfg.extraPackages;
|
||||||
|
|
||||||
xdg.configFile = mkMerge ([({
|
xdg.configFile = mkMerge ([({
|
||||||
"bat/config" =
|
"bat/config" =
|
||||||
|
@ -167,7 +167,7 @@ in {
|
||||||
export XDG_CACHE_HOME=${escapeShellArg config.xdg.cacheHome}
|
export XDG_CACHE_HOME=${escapeShellArg config.xdg.cacheHome}
|
||||||
verboseEcho "Rebuilding bat theme cache"
|
verboseEcho "Rebuilding bat theme cache"
|
||||||
cd "${pkgs.emptyDirectory}"
|
cd "${pkgs.emptyDirectory}"
|
||||||
run ${lib.getExe package} cache --build
|
run ${lib.getExe cfg.package} cache --build
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue