mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
bat: add custom themes
Add the ability to add custom theme files to bat. Co-Authored-By: Robert Helgesson <robert@rycee.net>
This commit is contained in:
parent
3e3de8cee2
commit
3a5cd90631
1 changed files with 25 additions and 4 deletions
|
@ -24,14 +24,35 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
themes = mkOption {
|
||||
type = types.attrsOf types.lines;
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
{
|
||||
dracula = builtins.readFile (pkgs.fetchFromGitHub {
|
||||
owner = "dracula";
|
||||
repo = "sublime"; # Bat uses sublime syntax for its themes
|
||||
rev = "26c57ec282abcaa76e57e055f38432bd827ac34e";
|
||||
sha256 = "019hfl4zbn4vm4154hh3bwk6hm7bdxbr1hdww83nabxwjn99ndhv";
|
||||
} + "/Dracula.tmTheme");
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Additional themes to provide.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.bat ];
|
||||
|
||||
xdg.configFile."bat/config" = mkIf (cfg.config != { }) {
|
||||
text = concatStringsSep "\n"
|
||||
(mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config);
|
||||
};
|
||||
xdg.configFile = mkMerge ([{
|
||||
"bat/config" = mkIf (cfg.config != { }) {
|
||||
text = concatStringsSep "\n"
|
||||
(mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config);
|
||||
};
|
||||
}] ++ flip mapAttrsToList cfg.themes
|
||||
(name: body: { "bat/themes/${name}.tmTheme" = { text = body; }; }));
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue