aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/viewer/bat/default.nix
blob: 73bdefda48e552ddd0991b9fe6dc41da9311762d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ config, lib, pkgs, ... }:

{
	options.tools.viewer.bat = {
		enable = lib.mkEnableOption "Enables bat.";
	};

	config = lib.mkIf config.tools.viewer.bat.enable {
		programs.bat.enable = true;
		programs.bat.config.theme = "custom-theme";
		shell.alias."cbat" = "${pkgs.bat}/bin/bat -pp";
		home.sessionVariables."PAGER" = "${pkgs.bat}/bin/bat --paging always";
		xdg.configFile."bat/themes/custom-theme.tmTheme".source
			= config.scheme {
				template = builtins.readFile ./theme.tmTheme.mustache;
			};
	};
}