home-manager/modules/programs/bat.nix

38 lines
689 B
Nix
Raw Normal View History

2019-02-11 05:57:10 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.bat;
2020-02-01 23:39:17 +00:00
in {
2019-02-11 05:57:10 +00:00
meta.maintainers = [ maintainers.marsam ];
options.programs.bat = {
enable = mkEnableOption "bat, a cat clone with wings";
config = mkOption {
type = types.attrsOf types.str;
2020-02-01 23:39:17 +00:00
default = { };
2019-02-11 05:57:10 +00:00
example = {
theme = "TwoDark";
pager = "less -FR";
};
description = ''
Bat configuration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.bat ];
2020-02-01 23:39:17 +00:00
xdg.configFile."bat/config" = mkIf (cfg.config != { }) {
text = concatStringsSep "\n"
(mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config);
2019-02-11 05:57:10 +00:00
};
};
}