nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, docbook-xsl-nons
4, fetchurl
5, glib
6, gobject-introspection
7, gtk-doc
8, libgudev
9, libpcap
10, meson
11, ninja
12, pkg-config
13, python3
14, systemd
15, usbutils
16, vala
17, which
18}:
19
20stdenv.mkDerivation rec {
21 pname = "umockdev";
22 version = "0.17.9";
23
24 outputs = [ "bin" "out" "dev" "devdoc" ];
25
26 src = fetchurl {
27 url = "https://github.com/martinpitt/umockdev/releases/download/${version}/${pname}-${version}.tar.xz";
28 sha256 = "sha256-FEmWjJVmKKckC30zULGI/mZ3VNtirnweZq2gKh/Y5VE=";
29 };
30
31 patches = [
32 # Hardcode absolute paths to libraries so that consumers
33 # do not need to set LD_LIBRARY_PATH themselves.
34 ./hardcode-paths.patch
35 ];
36
37 nativeBuildInputs = [
38 docbook-xsl-nons
39 gobject-introspection
40 gtk-doc
41 meson
42 ninja
43 pkg-config
44 vala
45 ];
46
47 buildInputs = [
48 glib
49 systemd
50 libgudev
51 libpcap
52 ];
53
54 checkInputs = [
55 python3
56 which
57 usbutils
58 ];
59
60 mesonFlags = [
61 "-Dgtk_doc=true"
62 ];
63
64 doCheck = true;
65
66 postPatch = ''
67 # Substitute the path to this derivation in the patch we apply.
68 substituteInPlace src/umockdev-wrapper \
69 --subst-var-by 'LIBDIR' "''${!outputLib}/lib"
70 '';
71
72 preCheck = ''
73 # Our patch makes the path to the `LD_PRELOAD`ed library absolute.
74 # When running tests, the library is not yet installed, though,
75 # so we need to replace the absolute path with a local one during build.
76 # We are using a symlink that will be overridden during installation.
77 mkdir -p "$out/lib"
78 ln -s "$PWD/libumockdev-preload.so.0" "$out/lib/libumockdev-preload.so.0"
79 '';
80
81 meta = with lib; {
82 description = "Mock hardware devices for creating unit tests";
83 license = licenses.lgpl21Plus;
84 maintainers = with maintainers; [ flokli ];
85 platforms = with platforms; linux;
86 };
87}