aboutsummaryrefslogtreecommitdiffstats
path: root/modules/terminal/bat/default.nix
blob: a35bcbead757a62b998e88be67be47f01de7d7fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# A cat clone with wings
{
  config,
  lib,
  pkgs,
  ...
}:
{
  options.terminal.bat = {
    enable = lib.mkEnableOption "Enables bat.";
    package = lib.mkOption {
      type = lib.types.package;
      readOnly = true;
      default = config.programs.bat.package;
      description = "The bat package to use.";
    };
  };

  config = lib.mkIf config.terminal.bat.enable {
    programs.bat = {
      enable = true;
      config = {
        theme = "base16";
      };
      themes = {
        base16 = {
          src = pkgs.runCommand "bat-base16-theme" { } ''
            mkdir -p $out
            cp ${config.scheme { template = ./base16.mustache.tmTheme; }} $out/base16.tmTheme
          '';
          file = "base16.tmTheme";
        };
      };
    };
  };
}