1{ lib, stdenv, fetchurl, memstreamHook }:
2
3stdenv.mkDerivation rec {
4 pname = "hyx";
5 version = "2021.06.09";
6
7 src = fetchurl {
8 url = "https://yx7.cc/code/hyx/hyx-${lib.replaceStrings [ "-" ] [ "." ] version}.tar.xz";
9 sha256 = "sha256-jU8U5YWE1syPBOQ8o4BC7tIYiCo4kknCCwhnMCVtpes=";
10 };
11
12 postPatch = lib.optionalString stdenv.isDarwin ''
13 substituteInPlace Makefile \
14 --replace "-Wl,-z,relro,-z,now -fpic -pie" ""
15 '';
16
17 buildInputs = lib.optional (stdenv.system == "x86_64-darwin") memstreamHook;
18
19 installPhase = ''
20 install -vD hyx $out/bin/hyx
21 '';
22
23 meta = with lib; {
24 description = "minimalistic but powerful Linux console hex editor";
25 homepage = "https://yx7.cc/code/";
26 license = licenses.mit;
27 maintainers = with maintainers; [ fpletz ];
28 platforms = with platforms; linux ++ darwin;
29 };
30}