1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 docbook_xml_dtd_43,
6 docbook-xsl-nons,
7 glib,
8 gobject-introspection,
9 gtk-doc,
10 meson,
11 ninja,
12 pkg-config,
13 python3,
14 shared-mime-info,
15 nixosTests,
16 xz,
17 zstd,
18 buildPackages,
19 withIntrospection ?
20 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
21 && stdenv.hostPlatform.emulatorAvailable buildPackages,
22}:
23
24stdenv.mkDerivation rec {
25 pname = "libxmlb";
26 version = "0.3.22";
27
28 outputs = [
29 "out"
30 "lib"
31 "dev"
32 "installedTests"
33 ]
34 ++ lib.optionals withIntrospection [
35 "devdoc"
36 ];
37
38 src = fetchFromGitHub {
39 owner = "hughsie";
40 repo = "libxmlb";
41 rev = version;
42 hash = "sha256-6S/4X6dYsVj9v98LoDJjir6Kmb5L8PloD23yvvkiD6o=";
43 };
44
45 patches = [
46 ./installed-tests-path.patch
47 ];
48
49 nativeBuildInputs = [
50 docbook_xml_dtd_43
51 docbook-xsl-nons
52 meson
53 ninja
54 pkg-config
55 python3
56 shared-mime-info
57 ]
58 ++ lib.optionals withIntrospection [
59 gobject-introspection
60 gtk-doc
61 ];
62
63 buildInputs = [
64 glib
65 xz
66 zstd
67 ];
68
69 mesonFlags = [
70 "--libexecdir=${placeholder "out"}/libexec"
71 (lib.mesonBool "gtkdoc" withIntrospection)
72 (lib.mesonBool "introspection" withIntrospection)
73 "-Dinstalled_test_prefix=${placeholder "installedTests"}"
74 ];
75
76 preCheck = ''
77 export XDG_DATA_DIRS=$XDG_DATA_DIRS:${shared-mime-info}/share
78 '';
79
80 doCheck = true;
81
82 passthru = {
83 tests = {
84 installed-tests = nixosTests.installed-tests.libxmlb;
85 };
86 };
87
88 meta = with lib; {
89 description = "Library to help create and query binary XML blobs";
90 mainProgram = "xb-tool";
91 homepage = "https://github.com/hughsie/libxmlb";
92 license = licenses.lgpl21Plus;
93 maintainers = [ ];
94 platforms = platforms.unix;
95 };
96}