1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 autoreconfHook,
7 makeWrapper,
8 perlPackages,
9 ocamlPackages,
10 libxml2,
11 libintl,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "hivex";
16 version = "1.3.24";
17
18 src = fetchurl {
19 url = "https://libguestfs.org/download/hivex/${pname}-${version}.tar.gz";
20 hash = "sha256-pS+kXOzJp4rbLShgXWgmHk8f1FFKd4pUcwE9LMyKGTw=";
21 };
22
23 patches = [ ./hivex-syms.patch ];
24
25 postPatch = ''
26 substituteInPlace ocaml/Makefile.am \
27 --replace '$(DESTDIR)$(OCAMLLIB)' '$(out)/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib'
28 '';
29
30 strictDeps = true;
31 nativeBuildInputs = [
32 autoreconfHook
33 makeWrapper
34 perlPackages.perl
35 pkg-config
36 ]
37 ++ (with ocamlPackages; [
38 ocaml
39 findlib
40 ]);
41 buildInputs = [
42 libxml2
43 ]
44 ++ (with perlPackages; [
45 perl
46 IOStringy
47 ])
48 ++ lib.optionals stdenv.hostPlatform.isDarwin [ libintl ];
49
50 enableParallelBuilding = true;
51
52 postInstall = ''
53 wrapProgram $out/bin/hivexregedit \
54 --set PERL5LIB "$out/${perlPackages.perl.libPrefix}" \
55 --prefix "PATH" : "$out/bin"
56
57 wrapProgram $out/bin/hivexml \
58 --prefix "PATH" : "$out/bin"
59 '';
60
61 meta = with lib; {
62 description = "Windows registry hive extraction library";
63 license = licenses.lgpl2Only;
64 homepage = "https://github.com/libguestfs/hivex";
65 maintainers = with maintainers; [ offline ];
66 platforms = platforms.unix;
67 };
68}