about summary refs log tree commit diff
path: root/third_party/bat_syntaxes/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-06-14T23·58+0100
committertazjin <mail@tazj.in>2020-06-15T16·52+0000
commit0b95b8632d142496b9443e0570eff62958518ff7 (patch)
treecb98bf8566d58c080edc0ac84074b7245d016c60 /third_party/bat_syntaxes/default.nix
parent81b6bde07427a525a4fec3c26ccf258b3bd021c5 (diff)
feat(3p/bat_syntaxes): Add a derivation to extend bat syntaxes r/966
This derivation can add arbitrary new Sublime syntaxes to bat's syntax
file, which is used by cheddar.

Included is a Prolog syntax. It is kind of mediocre, but better than
nothing.

Change-Id: I6ceecbc86a5dfba5886cd27bd5114721845446a7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/348
Reviewed-by: lukegb <lukegb@tvl.fyi>
Diffstat (limited to 'third_party/bat_syntaxes/default.nix')
-rw-r--r--third_party/bat_syntaxes/default.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/third_party/bat_syntaxes/default.nix b/third_party/bat_syntaxes/default.nix
new file mode 100644
index 000000000000..2b7d025fae57
--- /dev/null
+++ b/third_party/bat_syntaxes/default.nix
@@ -0,0 +1,17 @@
+# For depot projects that make use of syntect (primarily
+# //tools/cheddar) the included syntax set is taken from bat.
+#
+# However, bat lacks some of the syntaxes we are interested in. This
+# package creates a new binary syntax set which bundles our additional
+# syntaxes on top of bat's existing ones.
+{ pkgs, ... }:
+
+let
+  inherit (pkgs) bat runCommandNoCC;
+in runCommandNoCC "bat-syntaxes.bin" {} ''
+  export HOME=$PWD
+  mkdir -p .config/bat/syntaxes
+  cp ${./Prolog.sublime-syntax} .config/bat/syntaxes
+  ${bat}/bin/bat cache --build
+  mv .cache/bat/syntaxes.bin $out
+''