1{
2 stdenv, fetchurl, lib,
3 libxslt, pandoc, asciidoctor, pkgconfig,
4 dbus-glib, libcap_ng, libqb, libseccomp, polkit, protobuf, qtbase, qttools, qtsvg,
5 audit,
6 libgcrypt ? null,
7 libsodium ? null
8}:
9
10with stdenv.lib;
11
12assert libgcrypt != null -> libsodium == null;
13
14stdenv.mkDerivation rec {
15 version = "0.7.2";
16 name = "usbguard-${version}";
17
18 repo = "https://github.com/USBGuard/usbguard";
19
20 src = fetchurl {
21 url = "${repo}/releases/download/${name}/${name}.tar.gz";
22 sha256 = "5bd3e5219c590c3ae27b21315bd10b60e823cef64e5deff3305ff5b4087fc2d6";
23 };
24
25 nativeBuildInputs = [
26 libxslt
27 asciidoctor
28 pandoc # for rendering documentation
29 pkgconfig
30 ];
31
32 buildInputs = [
33 dbus-glib
34 libcap_ng
35 libqb
36 libseccomp
37 polkit
38 protobuf
39 audit
40
41 qtbase
42 qtsvg
43 qttools
44 ]
45 ++ (lib.optional (libgcrypt != null) libgcrypt)
46 ++ (lib.optional (libsodium != null) libsodium);
47
48 configureFlags = [
49 "--with-bundled-catch"
50 "--with-bundled-pegtl"
51 "--with-dbus"
52 "--with-gui-qt=qt5"
53 "--with-polkit"
54 ]
55 ++ (lib.optional (libgcrypt != null) "--with-crypto-library=gcrypt")
56 ++ (lib.optional (libsodium != null) "--with-crypto-library=sodium");
57
58 enableParallelBuilding = true;
59
60 meta = {
61 description = "The USBGuard software framework helps to protect your computer against BadUSB.";
62 homepage = "https://usbguard.github.io/";
63 license = licenses.gpl2;
64 maintainers = [ maintainers.tnias ];
65 };
66}