Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'grammars.nix')
-rw-r--r--grammars.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/grammars.nix b/grammars.nix
index 1b4da224..bc99d21d 100644
--- a/grammars.nix
+++ b/grammars.nix
@@ -1,13 +1,22 @@
{
stdenv,
lib,
+ runCommandLocal,
runCommand,
+ yj,
includeGrammarIf ? _: true,
grammarOverlays ? [],
...
}: let
+ # HACK: nix < 2.6 has a bug in the toml parser, so we convert to JSON
+ # before parsing
+ languages-json = runCommandLocal "languages-toml-to-json" {} ''
+ ${yj}/bin/yj -t < ${./languages.toml} > $out
+ '';
languagesConfig =
- builtins.fromTOML (builtins.readFile ./languages.toml);
+ if lib.versionAtLeast builtins.nixVersion "2.6.0"
+ then builtins.fromTOML (builtins.readFile ./languages.toml)
+ else builtins.fromJSON (builtins.readFile (builtins.toPath languages-json));
isGitGrammar = grammar:
builtins.hasAttr "source" grammar
&& builtins.hasAttr "git" grammar.source
@@ -87,6 +96,8 @@
$CC -c src/parser.c -o parser.o $FLAGS
$CXX -shared -o $NAME.so *.o
+ ls -al
+
runHook postBuild
'';