Unverified Commit 1dcba303 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

topiary: 0.6.1 -> 0.7.0 (#457453)

parents cb4b92fb e42a25c5
Loading
Loading
Loading
Loading
+12 −21
Original line number Diff line number Diff line
@@ -3,41 +3,29 @@
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  iconv,
  installShellFiles,
  versionCheckHook,
  nix-update-script,
}:
rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "topiary";
  version = "0.6.1";
  version = "0.7.0";

  src = fetchFromGitHub {
    owner = "tweag";
    repo = "topiary";
    tag = "v${version}";
    hash = "sha256-CyqZhkzAOqC3xWhwUzCpkDO0UFsO0S4/3sV7zIILiVg=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-49LTUtgroD0wCwJYYb/IN1lsWbAtdfKjGNMuUa2+vhI=";
  };

  nativeBuildInputs = [ installShellFiles ];
  nativeInstallCheckInputs = [ versionCheckHook ];

  cargoHash = "sha256-akAjn9a7dMwjPSNveDY2KJ62evjHCAWpRR3A7Ghkb5A=";
  cargoHash = "sha256-I3hsaA4N2x00J5+U0z2B1gi1N7QVf7Vnab2scjDpWoo=";

  # https://github.com/NixOS/nixpkgs/pull/359145#issuecomment-2542418786
  depsExtraArgs.postBuild = ''
    find $out -name '*.ps1' -print | while read -r file; do
      if [ "$(file --brief --mime-encoding "$file")" == utf-16be ]; then
        ${iconv}/bin/iconv -f UTF-16BE -t UTF16LE "$file" > tmp && mv tmp "$file"
      fi
    done
  '';
  nativeBuildInputs = [ installShellFiles ];

  cargoBuildFlags = [
    "-p"
    "topiary-cli"
  ];
  cargoTestFlags = cargoBuildFlags;

  # Skip tests that cannot be executed in sandbox (operation not permitted)
  checkFlags = [
@@ -76,6 +64,7 @@ rustPlatform.buildRustPackage rec {
    "--skip=test_vis"
    "--skip=test_vis_invalid"
  ];
  cargoTestFlags = finalAttrs.cargoBuildFlags;

  env.TOPIARY_LANGUAGE_DIR = "${placeholder "out"}/share/queries";

@@ -89,6 +78,8 @@ rustPlatform.buildRustPackage rec {
      --zsh <($out/bin/topiary completion zsh)
  '';

  nativeInstallCheckInputs = [ versionCheckHook ];

  doInstallCheck = true;
  versionCheckProgramArg = "--version";

@@ -96,12 +87,12 @@ rustPlatform.buildRustPackage rec {

  meta = {
    description = "Uniform formatter for simple languages, as part of the Tree-sitter ecosystem";
    mainProgram = "topiary";
    homepage = "https://github.com/tweag/topiary";
    changelog = "https://github.com/tweag/topiary/blob/${src.tag}/CHANGELOG.md";
    changelog = "https://github.com/tweag/topiary/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      nartsiss
    ];
    mainProgram = "topiary";
  };
}
})