From 051320062e5d1288bc989c7f3e39ef903c618104 Mon Sep 17 00:00:00 2001
From: Andrew Childs <lorne@cons.org.nz>
Date: Thu, 2 May 2019 01:14:19 +0900
Subject: [PATCH] libusb1: optionally enable static library

---
 pkgs/development/libraries/libusb1/default.nix | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix
index ac5c38a34f1..0620163bb32 100644
--- a/pkgs/development/libraries/libusb1/default.nix
+++ b/pkgs/development/libraries/libusb1/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit }:
+{ stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit, withStatic ? false }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
   name = "libusb-1.0.22";
 
   src = fetchurl {
@@ -32,4 +32,8 @@ stdenv.mkDerivation rec {
     license = licenses.lgpl21Plus;
     maintainers = [ ];
   };
-}
+} // stdenv.lib.optionalAttrs withStatic {
+  # Carefully added here to avoid a mass rebuild.
+  # Inline this the next time this package changes.
+  dontDisableStatic = withStatic;
+})