1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5 cmake,
6 python3,
7 versionCheckHook,
8 nix-update-script,
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "hexpatch";
13 version = "1.12.4";
14
15 src = fetchFromGitHub {
16 owner = "Etto48";
17 repo = "HexPatch";
18 tag = "v${version}";
19 hash = "sha256-ThHRf3zLNpOiIpB7drLqMBdyRl6MqW45oFpz44uBwsY=";
20 };
21
22 cargoHash = "sha256-kMLLtrXjduQ2nyiNtiZOhlEfADhn1IKysF29WO6R8CE=";
23
24 nativeBuildInputs = [
25 cmake
26 python3
27 ];
28
29 postFixup = ''
30 ln -s $out/bin/hex-patch $out/bin/hexpatch
31 '';
32
33 nativeInstallCheckInputs = [
34 versionCheckHook
35 ];
36 versionCheckProgramArg = "--version";
37 doInstallCheck = true;
38
39 passthru = {
40 updateScript = nix-update-script { };
41 };
42
43 meta = {
44 description = "Binary patcher and editor written in Rust with a terminal user interface";
45 longDescription = ''
46 HexPatch is a binary patcher and editor with a terminal user interface (TUI),
47 capable of disassembling instructions and assembling patches. It supports a
48 variety of architectures and file formats, and can edit remote files
49 via SSH.
50 '';
51 homepage = "https://etto48.github.io/HexPatch/";
52 changelog = "https://github.com/Etto48/HexPatch/releases/tag/v${version}";
53 license = lib.licenses.mit;
54 maintainers = with lib.maintainers; [ ratcornu ];
55 mainProgram = "hexpatch";
56 };
57}