Commit cef3d0e2 authored by mlyxshi's avatar mlyxshi
Browse files

evil-helix: use wrapped helix tree-sitter grammars built from source

parent 1193a357
Loading
Loading
Loading
Loading
+53 −39
Original line number Diff line number Diff line
@@ -5,9 +5,19 @@
  installShellFiles,
  nix-update-script,
  rustPlatform,
  runCommand,
  makeBinaryWrapper,
}:

rustPlatform.buildRustPackage (finalAttrs: {
rustPlatform.buildRustPackage (
  finalAttrs:
  let
    defaultRuntimeDir = runCommand "evil-helix-default-runtime" { } ''
      cp -r --no-preserve=mode ${finalAttrs.src}/runtime $out
      rm -rf $out/grammars $out/queries
    '';
  in
  {
    pname = "evil-helix";
    version = "20250915";

@@ -20,20 +30,23 @@ rustPlatform.buildRustPackage (finalAttrs: {

    cargoHash = "sha256-Mf0nrgMk1MlZkSyUN6mlM5lmTcrOHn3xBNzmVGtApEU=";

  nativeBuildInputs = [ installShellFiles ];
    nativeBuildInputs = [
      installShellFiles
      makeBinaryWrapper
    ];

    env = {
      # disable fetching and building of tree-sitter grammars in the helix-term build.rs
      HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
    HELIX_DEFAULT_RUNTIME = helix.runtime;
      HELIX_DEFAULT_RUNTIME = defaultRuntimeDir;
    };

    postInstall = ''
    mkdir -p $out/lib
      installShellCompletion contrib/completion/hx.{bash,fish,zsh}
      mkdir -p $out/share/{applications,icons/hicolor/256x256/apps}
      cp contrib/Helix.desktop $out/share/applications
      cp contrib/helix.png $out/share/icons/hicolor/256x256/apps
      wrapProgram $out/bin/hx --set HELIX_RUNTIME ${helix.runtime}
    '';

    passthru.updateScript = nix-update-script { };
@@ -45,4 +58,5 @@ rustPlatform.buildRustPackage (finalAttrs: {
      mainProgram = "hx";
      maintainers = with lib.maintainers; [ thiagokokada ];
    };
})
  }
)