about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/usbguard/default.nix
blob: 1c5678b81e03acd6dd1795c65bdc45dc7318e984 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  stdenv, fetchurl, lib,
  pkgconfig, libxml2, libxslt,
  dbus-glib, libcap_ng, libqb, libseccomp, polkit, protobuf, audit,
  withGui ? true,
  qtbase ? null,
  qttools ? null,
  qtsvg ? null,
  libgcrypt ? null,
  libsodium ? null
}:

with stdenv.lib;

assert libgcrypt != null -> libsodium == null;

stdenv.mkDerivation rec {
  version = "0.7.4";
  name = "usbguard-${version}";

  repo = "https://github.com/USBGuard/usbguard";

  src = fetchurl {
    url = "${repo}/releases/download/${name}/${name}.tar.gz";
    sha256 = "1qkskd6q5cwlh2cpcsbzmmmgk6w63z0825wlb2sjwqq3kfgwjb3k";
  };

  nativeBuildInputs = [
    pkgconfig
    libxslt # xsltproc
    libxml2 # xmllint
  ];

  buildInputs = [
    dbus-glib
    libcap_ng
    libqb
    libseccomp
    polkit
    protobuf
    audit
  ]
  ++ (lib.optional (libgcrypt != null) libgcrypt)
  ++ (lib.optional (libsodium != null) libsodium)
  ++ (lib.optionals withGui [ qtbase qtsvg qttools ]);

  configureFlags = [
    "--with-bundled-catch"
    "--with-bundled-pegtl"
    "--with-dbus"
    "--with-polkit"
  ]
  ++ (lib.optional (libgcrypt != null) "--with-crypto-library=gcrypt")
  ++ (lib.optional (libsodium != null) "--with-crypto-library=sodium")
  ++ (lib.optional withGui "--with-gui-qt=qt5");

  enableParallelBuilding = true;

  meta = {
    description = "The USBGuard software framework helps to protect your computer against BadUSB.";
    homepage = "https://usbguard.github.io/";
    license = licenses.gpl2;
    maintainers = [ maintainers.tnias ];
  };
}