aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/viewer/bat/default.nix
blob: 4d52a6283bcbbc397947100e58f43624e10a563a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ 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 = {
			tabs = "4";
			theme = "custom-theme";
		};
		shell.alias."cat" = "${pkgs.bat}/bin/bat -pp";
		shell.alias."less" = "${pkgs.bat}/bin/bat --paging always";
		home.sessionVariables."PAGER" = "${pkgs.bat}/bin/bat --paging always";
		xdg.configFile."bat/themes/custom-theme.tmTheme".source
			= config.scheme {
				template = builtins.readFile ./theme.mustache.tmTheme;
			};
	};
}