-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
- Loading branch information
1 parent
0622467
commit 7214fac
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
pkgs, | ||
config, | ||
lib, | ||
... | ||
}: | ||
let | ||
inherit (lib.options) mkEnableOption mkPackageOption mkOption; | ||
inherit (lib.modules) mkIf; | ||
inherit (lib.lists) optionals; | ||
inherit (lib.types) lines; | ||
inherit (lib) maintainers; | ||
cfg = config.programs.bat; | ||
in | ||
{ | ||
options.programs.bat = { | ||
enable = mkEnableOption "`bat`, a {manpage}`cat(1)` clone with wings"; | ||
package = mkPackageOption pkgs "bat" { }; | ||
enableExtras = mkEnableOption "`bat`'s extra scripts and utilities"; | ||
# TODO: Somehow turn this into a structured submodule per RFC 0042. | ||
# `bat`'s configuration syntax translates particularly terribly to | ||
# Nix as some options can be declared multiple times and many options | ||
# are actually aliases to other options and shouldn't be set together. | ||
extraConfig = mkOption { | ||
default = ""; | ||
example = '' | ||
--theme="TwoDark" | ||
--italic-text=always | ||
--paging=never | ||
--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse" | ||
--map-syntax "*.ino:C++" | ||
--map-syntax ".ignore:Git Ignore" | ||
''; | ||
description = '' | ||
Lines to be appended verbatim to the system-wide `bat` configuration file. | ||
''; | ||
type = lines; | ||
}; | ||
}; | ||
config = mkIf cfg.enable { | ||
environment = { | ||
systemPackages = | ||
[ cfg.package ] | ||
++ optionals cfg.enableExtras ( | ||
with pkgs.bat-extras; | ||
[ | ||
batdiff | ||
batgrep | ||
batman | ||
batpipe | ||
batwatch | ||
prettybat | ||
] | ||
); | ||
etc."bat/config".text = cfg.extraConfig; | ||
}; | ||
}; | ||
meta.maintainers = with maintainers; [ sigmasquadron ]; | ||
} |