Skip to content

Commit

Permalink
plugins/treesitter: add an option to control if gcc should be installed
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Jan 4, 2024
1 parent 78276e9 commit 2785267
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions plugins/languages/treesitter/treesitter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ in {
description = "Either \"all\" or a list of languages";
};

gccPackage = mkOption {
type = with types; nullOr package;
default =
if cfg.nixGrammars
then null
else pkgs.gcc;
example = null;
description = ''
Which package (if any) to be added as the GCC compiler.
This is required to build grammars if you are not using `nixGrammars`.
To disable the installation of GCC, set this option to `null`.
'';
};

parserInstallDir = mkOption {
type = types.nullOr types.str;
default =
Expand Down Expand Up @@ -199,11 +213,12 @@ in {
if cfg.nixGrammars
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
else [cfg.package];
extraPackages = with pkgs; [
tree-sitter
nodejs
gcc
];
extraPackages = with pkgs;
[
tree-sitter
nodejs
]
++ optional (cfg.gccPackage != null) cfg.gccPackage;

options = mkIf cfg.folding {
foldmethod = "expr";
Expand Down

0 comments on commit 2785267

Please sign in to comment.