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