From 36e4dfdaac2f83c765ef6d039fcc5b181cbe1d30 Mon Sep 17 00:00:00 2001 From: Producer Matt <58014742+ProducerMatt@users.noreply.github.com> Date: Sat, 23 Mar 2024 22:11:44 -0500 Subject: [PATCH] tere: 1.5.0 -> 1.5.1-unstable-2024-04-01 --- pkgs/tools/misc/tere/default.nix | 50 ++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/misc/tere/default.nix b/pkgs/tools/misc/tere/default.nix index 70bd03ccaa49..0d1f35088711 100644 --- a/pkgs/tools/misc/tere/default.nix +++ b/pkgs/tools/misc/tere/default.nix @@ -1,21 +1,53 @@ -{ lib, fetchFromGitHub, rustPlatform }: +{ lib, fetchFromGitHub, rustPlatform, ncurses, stdenv, python3 }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage { pname = "tere"; - version = "1.5.0"; + version = "1.5.1-unstable-2024-04-01"; src = fetchFromGitHub { owner = "mgunyho"; repo = "tere"; - rev = "v${version}"; - sha256 = "sha256-xqbFBRzBfTwSdkC8e85yANdVA45G6E1FYlTXP8QfVIk="; + rev = "659422ecb2810f91446a71e52b82524d4f1755d8"; + sha256 = "sha256-CH8gcfkjSAknG6kKHp0aODcrjEJjzHbgeVaE/PK1zRA="; }; - cargoHash = "sha256-Y2Zgo/VAJxzQd2cXxyiJS5AqcVRClAuUsEogivK3EJw="; + cargoHash = "sha256-GtGWuvYdxP3dgGekoXYaM+lnZJBgJX1UIWe0EH+/52M="; - postPatch = '' - rm .cargo/config.toml; - ''; + nativeBuildInputs = [ + # ncurses provides the tput command needed for integration tests + # https://github.com/mgunyho/tere/issues/93#issuecomment-2029624187 + ncurses + ]; + + checkFlags = lib.optionals stdenv.isDarwin [ + # Unexplained fail + # https://github.com/NixOS/nixpkgs/pull/298527#issuecomment-2053758845 + "--skip=first_run_prompt_accept" + ]; + + # NOTE: workaround for build fail on aarch64 + # See https://github.com/NixOS/nixpkgs/issues/145726#issuecomment-971331986 + preBuild = + let + python-with-toml = python3.withPackages (ps: [ps.toml]); + script = builtins.toFile "clear_linkers.py" '' + from os import path + import toml + + if path.exists(".cargo/config.toml"): + config = toml.load(open(".cargo/config.toml")) + + for target in config.get("target",{}).values(): + if "linker" in target: + del target["linker"] + + toml.dump(config,open(".cargo/config.toml", "w")) + else: + print(__file__, ": CONFIG.TOML EXPECTED") + exit(1) + ''; + in + "${python-with-toml}/bin/python3 ${script}"; meta = with lib; { description = "A faster alternative to cd + ls";