diff options
-rw-r--r-- | third_party/default.nix | 1 | ||||
-rw-r--r-- | tools/cheddar/default.nix | 19 | ||||
-rw-r--r-- | tools/cheddar/src/main.rs | 3 |
3 files changed, 21 insertions, 2 deletions
diff --git a/third_party/default.nix b/third_party/default.nix index afe05ccb52b5..aade83074640 100644 --- a/third_party/default.nix +++ b/third_party/default.nix @@ -22,6 +22,7 @@ let # of the repo. They become available under `pkgs.third_party.<name>` inherit (nixpkgs) bashInteractive + bat buildGoPackage cacert cachix diff --git a/tools/cheddar/default.nix b/tools/cheddar/default.nix index 190a05c80577..ed4814be0a78 100644 --- a/tools/cheddar/default.nix +++ b/tools/cheddar/default.nix @@ -1,3 +1,20 @@ { pkgs, ... }: -pkgs.third_party.naersk.buildPackage ./. +with pkgs.third_party; + +naersk.buildPackage { + src = ./.; + doDoc = false; + doCheck = false; + + override = x: { + # bat contains syntax highlighting packages for a lot more + # languages than what ships with syntect, and we can make use of + # them! + BAT_SYNTAXES = "${bat.src}/assets/syntaxes.bin"; + + # LLVM packages (why are they even required?) are not found + # automatically if added to buildInputs, hence this ... + LIBCLANG_PATH = "${llvmPackages.libclang}/lib/libclang.so.7"; + }; +} diff --git a/tools/cheddar/src/main.rs b/tools/cheddar/src/main.rs index 1d58bb2ad462..9cf85385705d 100644 --- a/tools/cheddar/src/main.rs +++ b/tools/cheddar/src/main.rs @@ -4,6 +4,7 @@ use std::io::BufRead; use std::io; use std::path::Path; use syntect::easy::HighlightLines; +use syntect::dumps::from_binary; use syntect::highlighting::ThemeSet; use syntect::parsing::{SyntaxSet, SyntaxReference}; @@ -35,7 +36,7 @@ fn should_continue(res: &io::Result<usize>) -> bool { } fn main() { - let syntaxes = SyntaxSet::load_defaults_newlines(); + let syntaxes = from_binary(include_bytes!(env!("BAT_SYNTAXES"))); let stdin = io::stdin(); let mut stdin = stdin.lock(); |