bat: add module

This commit is contained in:
Mario Rodas 2019-02-11 00:57:10 -05:00 committed by Robert Helgesson
parent 989e636d98
commit 24b5f62090
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 48 additions and 0 deletions

View file

@ -998,6 +998,13 @@ in
A new service is available: 'services.mpdris2'. A new service is available: 'services.mpdris2'.
''; '';
} }
{
time = "2019-03-19T22:56:20+00:00";
message = ''
A new module is available: 'programs.bat'.
'';
}
]; ];
}; };
} }

View file

@ -38,6 +38,7 @@ let
(loadModule ./programs/astroid.nix { }) (loadModule ./programs/astroid.nix { })
(loadModule ./programs/autorandr.nix { }) (loadModule ./programs/autorandr.nix { })
(loadModule ./programs/bash.nix { }) (loadModule ./programs/bash.nix { })
(loadModule ./programs/bat.nix { })
(loadModule ./programs/beets.nix { }) (loadModule ./programs/beets.nix { })
(loadModule ./programs/browserpass.nix { }) (loadModule ./programs/browserpass.nix { })
(loadModule ./programs/chromium.nix { condition = hostPlatform.isLinux; }) (loadModule ./programs/chromium.nix { condition = hostPlatform.isLinux; })

40
modules/programs/bat.nix Normal file
View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.bat;
in
{
meta.maintainers = [ maintainers.marsam ];
options.programs.bat = {
enable = mkEnableOption "bat, a cat clone with wings";
config = mkOption {
type = types.attrsOf types.str;
default = {};
example = {
theme = "TwoDark";
pager = "less -FR";
};
description = ''
Bat configuration.
'';
};
};
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
);
};
};
}