mirror of https://github.com/helix-editor/helix
chore: clean up grammars.nix (#13506)
parent
cb1ecc9128
commit
9bb370c91e
11
grammars.nix
11
grammars.nix
|
@ -1,22 +1,13 @@
|
||||||
{
|
{
|
||||||
stdenv,
|
stdenv,
|
||||||
lib,
|
lib,
|
||||||
runCommandLocal,
|
|
||||||
runCommand,
|
runCommand,
|
||||||
yj,
|
|
||||||
includeGrammarIf ? _: true,
|
includeGrammarIf ? _: true,
|
||||||
grammarOverlays ? [],
|
grammarOverlays ? [],
|
||||||
...
|
...
|
||||||
}: let
|
}: 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 =
|
languagesConfig =
|
||||||
if lib.versionAtLeast builtins.nixVersion "2.6.0"
|
builtins.fromTOML (builtins.readFile ./languages.toml);
|
||||||
then builtins.fromTOML (builtins.readFile ./languages.toml)
|
|
||||||
else builtins.fromJSON (builtins.readFile (builtins.toPath languages-json));
|
|
||||||
isGitGrammar = grammar:
|
isGitGrammar = grammar:
|
||||||
builtins.hasAttr "source" grammar
|
builtins.hasAttr "source" grammar
|
||||||
&& builtins.hasAttr "git" grammar.source
|
&& builtins.hasAttr "git" grammar.source
|
||||||
|
|
Loading…
Reference in New Issue