Unverified Commit 12e4c5a8 authored by Matthieu Coudron's avatar Matthieu Coudron Committed by GitHub
Browse files

helix-unwrapped: init at 25.07.1 (#496253)

parents 47c8b8de cef3d0e2
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 ];
    };
})
  }
)
+91 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  runCommand,
  installShellFiles,
  mdbook,
  versionCheckHook,
}:

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

    outputs = [
      "out"
      "doc"
    ];

    src = fetchFromGitHub {
      owner = "helix-editor";
      repo = "helix";
      tag = finalAttrs.version;
      hash = "sha256-RFSzGAcB0mMg/02ykYfTWXzQjLFu2CJ4BkS5HZ/6pBo=";
    };

    cargoHash = "sha256-Mf0nrgMk1MlZkSyUN6mlM5lmTcrOHn3xBNzmVGtApEU=";

    patches = [
      # Support mdbook 0.5.x: escape HTML tags in command descriptions
      ./mdbook-0.5-support.patch
    ];

    postPatch = ''
      # mdbook 0.5 uses asset hashing for CSS/JS files
      # Remove custom theme to use default mdbook theme with correct asset references
      rm -f book/theme/index.hbs
    '';

    nativeBuildInputs = [
      installShellFiles
      mdbook
    ];

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

    postBuild = ''
      mdbook build book -d ../book-html
    '';

    postInstall = ''
      installShellCompletion contrib/completion/hx.{bash,fish,zsh}
      mkdir -p $out/share/{applications,icons/hicolor/256x256/apps}
      cp contrib/Helix.desktop $out/share/applications/Helix.desktop
      cp contrib/helix.png $out/share/icons/hicolor/256x256/apps/helix.png
      mkdir -p $doc/share/doc
      cp -r ../book-html $doc/share/doc/$name
    '';

    nativeInstallCheckInputs = [
      versionCheckHook
    ];
    versionCheckProgram = "${placeholder "out"}/bin/hx";
    doInstallCheck = true;

    meta = {
      description = "Post-modern modal text editor";
      homepage = "https://helix-editor.com";
      changelog = "https://github.com/helix-editor/helix/blob/${finalAttrs.version}/CHANGELOG.md";
      license = lib.licenses.mpl20;
      mainProgram = "hx";
      maintainers = with lib.maintainers; [
        aciceri
        danth
        yusdacra
      ];
    };
  }
)
+81 −136
Original line number Diff line number Diff line
{
  fetchFromGitHub,
  lib,
  rustPlatform,
  mdbook,
  gitMinimal,
  installShellFiles,
  versionCheckHook,
  symlinkJoin,
  runCommand,
  makeBinaryWrapper,
  helix-unwrapped,
  removeReferencesTo,
  pkgs,
  tree-sitter,
@@ -22,9 +19,6 @@
    }
  ),
}:

rustPlatform.buildRustPackage (
  finalAttrs:
let
  lockedVersionsOverlay =
    final: prev:
@@ -64,9 +58,9 @@ rustPlatform.buildRustPackage (
  lockedGrammarsCount = lib.length (lib.attrNames lockedGrammars);

  runtimeDir = runCommand "helix-runtime" { } ''
      cp -r --no-preserve=mode ${finalAttrs.src}/runtime $out
      rm -r $out/grammars
    mkdir -p $out
    ln -s ${grammarsFarm} $out/grammars
    cp -r --no-preserve=mode ${helix-unwrapped.src}/runtime/queries $out
    count=$(ls -1 "$out/grammars/" | wc -l)
    if [ "$count" -ne ${toString lockedGrammarsCount} ]; then
      echo "Expected ${toString lockedGrammarsCount} grammars, found $count"
@@ -74,64 +68,18 @@ rustPlatform.buildRustPackage (
    fi
  '';
in
  {
    pname = "helix";
    version = "25.07.1";
    outputs = [
      "out"
      "doc"
    ];

    src = fetchFromGitHub {
      owner = "helix-editor";
      repo = "helix";
      tag = "${finalAttrs.version}";
      hash = "sha256-RFSzGAcB0mMg/02ykYfTWXzQjLFu2CJ4BkS5HZ/6pBo=";
    };

    patches = [
      # Support mdbook 0.5.x: escape HTML tags in command descriptions
      ./mdbook-0.5-support.patch
    ];

    postPatch = ''
      # mdbook 0.5 uses asset hashing for CSS/JS files
      # Remove custom theme to use default mdbook theme with correct asset references
      rm -f book/theme/index.hbs
    '';

    cargoHash = "sha256-Mf0nrgMk1MlZkSyUN6mlM5lmTcrOHn3xBNzmVGtApEU=";

    nativeBuildInputs = [
      gitMinimal
      installShellFiles
      mdbook
    ];
symlinkJoin {
  pname = "helix";
  inherit (helix-unwrapped) version;

    env = {
      HELIX_DEFAULT_RUNTIME = runtimeDir;
      HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
    };
  paths = [ helix-unwrapped ];
  nativeBuildInputs = [ makeBinaryWrapper ];

  postBuild = ''
      mdbook build book -d ../book-html
    wrapProgram $out/bin/hx --set HELIX_RUNTIME "${runtimeDir}"
  '';

    postInstall = ''
      mkdir -p $out/lib $doc/share/doc
      installShellCompletion contrib/completion/hx.{bash,fish,zsh}
      mkdir -p $out/share/{applications,icons/hicolor/256x256/apps}
      cp contrib/Helix.desktop $out/share/applications/Helix.desktop
      cp contrib/helix.png $out/share/icons/hicolor/256x256/apps/helix.png
      cp -r ../book-html $doc/share/doc/$name
    '';

    nativeInstallCheckInputs = [
      versionCheckHook
    ];
    versionCheckProgram = "${placeholder "out"}/bin/hx";
    doInstallCheck = true;

  passthru = {
    updateScript = ./update.sh;
    runtime = runtimeDir;
@@ -139,16 +87,13 @@ rustPlatform.buildRustPackage (
  };

  meta = {
      description = "Post-modern modal text editor";
      homepage = "https://helix-editor.com";
      changelog = "https://github.com/helix-editor/helix/blob/${finalAttrs.version}/CHANGELOG.md";
      license = lib.licenses.mpl20;
      mainProgram = "hx";
      maintainers = with lib.maintainers; [
        aciceri
        danth
        yusdacra
      ];
    inherit (helix-unwrapped.meta)
      description
      homepage
      changelog
      license
      mainProgram
      maintainers
      ;
  };
}
)
+2 −2
Original line number Diff line number Diff line
@@ -6,10 +6,10 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

echo "Updating helix source to the latest stable..."
nix-update helix
nix-update helix-unwrapped

echo "Fetching updated helixSource..."
HELIX_SRC=$(nix-instantiate --eval -A "helix.src.outPath" --raw)
HELIX_SRC=$(nix-instantiate --eval -A "helix-unwrapped.src.outPath" --raw)

echo "Generating grammars.json..."
"$SCRIPT_DIR/generate_grammars.py" \