about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/umockdev/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/umockdev/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/umockdev/default.nix26
1 files changed, 21 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/development/libraries/umockdev/default.nix b/nixpkgs/pkgs/development/libraries/umockdev/default.nix
index b40f465546d9..cb1a8dccffd1 100644
--- a/nixpkgs/pkgs/development/libraries/umockdev/default.nix
+++ b/nixpkgs/pkgs/development/libraries/umockdev/default.nix
@@ -18,14 +18,14 @@
 , which
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "umockdev";
   version = "0.17.17";
 
   outputs = [ "bin" "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "https://github.com/martinpitt/umockdev/releases/download/${version}/${pname}-${version}.tar.xz";
+    url = "https://github.com/martinpitt/umockdev/releases/download/${finalAttrs.version}/umockdev-${finalAttrs.version}.tar.xz";
     sha256 = "sha256-IOYhseRYsyADz+qZc5tngkuGZShUqLzjPiYSTjR/32w=";
   };
 
@@ -50,10 +50,13 @@ stdenv.mkDerivation rec {
   buildInputs = [
     glib
     systemd
-    libgudev
     libpcap
   ];
 
+  checkInputs = lib.optionals finalAttrs.passthru.withGudev [
+    libgudev
+  ];
+
   nativeCheckInputs = [
     python3
     which
@@ -81,12 +84,25 @@ stdenv.mkDerivation rec {
     ln -s "$PWD/libumockdev-preload.so.0" "$out/lib/libumockdev-preload.so.0"
   '';
 
+  passthru = {
+    # libgudev is needed for an optional test but it itself relies on umockdev for testing.
+    withGudev = false;
+
+    tests = {
+      withGudev = finalAttrs.finalPackage.overrideAttrs (attrs: {
+        passthru = attrs.passthru // {
+          withGudev = true;
+        };
+      });
+    };
+  };
+
   meta = with lib; {
     homepage = "https://github.com/martinpitt/umockdev";
-    changelog = "https://github.com/martinpitt/umockdev/releases/tag/${version}";
+    changelog = "https://github.com/martinpitt/umockdev/releases/tag/${finalAttrs.version}";
     description = "Mock hardware devices for creating unit tests";
     license = licenses.lgpl21Plus;
     maintainers = with maintainers; [ flokli ];
     platforms = with platforms; linux;
   };
-}
+})