diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-15 07:40:33 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-18 05:26:24 +0100 |
commit | 0d96613d9aa41f93ebb440bb1aa383456b49f28f (patch) | |
tree | 8338371bcdeb58957f3b312517cebc9763b380ba /default.nix | |
parent | 4013b920f51790a88b5afce5be72c52b8cb2adc6 (diff) |
feat: drop haskell-tree-sitter
Drop haskell-tree-sitter in favor of custom bindings to tree-sitter.
haskell-tree-sitter is outdated and seems unmaintained.
The implementation add low-level bindings to tree-sitter and traverses
the AST in Haskell.
We suspect that many FFI calls are more expensive than performing just a
single API call to a C function that does the traversal.
This will be addressed in upcoming commits.
@prerequisite-for add-languages-elm-shell-nix
Diffstat (limited to 'default.nix')
-rw-r--r-- | default.nix | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/default.nix b/default.nix index 59d560e..9667ef6 100644 --- a/default.nix +++ b/default.nix @@ -12,6 +12,25 @@ }); }) (self: super: { + tree-sitter-grammars = pkgs.lib.mapAttrs + (name: grammar: + if self.lib.isDerivation grammar then + pkgs.stdenv.mkDerivation + { + inherit (grammar) pname version; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/lib + cp ${grammar}/parser $out/lib/lib${name}.so + ''; + } + else + grammar + + ) + super.tree-sitter-grammars; + }) + (self: super: { anissue = pkgs.writers.writeDashBin "anissue" '' set -efu exec cabal run anissue -- "$@" @@ -25,7 +44,10 @@ let haskellPackages = pkgs.haskellPackages.override { overrides = self: super: { - anissue = (super.callCabal2nix "anissue" ./. { }).overrideAttrs (oldAttrs: rec { + anissue = (super.callCabal2nix "anissue" ./. { + inherit (pkgs) tree-sitter; + inherit (pkgs.tree-sitter-grammars) tree-sitter-haskell; + }).overrideAttrs (oldAttrs: rec { nativeBuildInputs = [ pkgs.installShellFiles ]; buildInputs = oldAttrs.buildInputs or [ ] ++ [ pkgs.makeWrapper ]; passthru = oldAttrs.passthru // { @@ -63,7 +85,12 @@ rec { pkgs.ghcid pkgs.haskell-language-server pkgs.tree-sitter - ] ++ anissue.passthru.dependencies; + ] + ++ ( + pkgs.lib.filter pkgs.lib.isDerivation + (pkgs.lib.attrValues pkgs.tree-sitter-grammars) + ) + ++ anissue.passthru.dependencies; withHoogle = true; withHaddock = true; shellHook = '' |