2021-01-15 18:26:47 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
2021-01-21 23:12:29 +01:00
|
|
|
, installShellFiles
|
2021-01-16 23:15:52 +01:00
|
|
|
, nixosTests
|
2021-01-15 18:26:47 +01:00
|
|
|
, asciidoc
|
2021-01-19 07:50:56 +01:00
|
|
|
, pkg-config
|
2021-01-15 18:26:47 +01:00
|
|
|
, libxslt
|
|
|
|
, libxml2
|
|
|
|
, docbook_xml_dtd_45
|
|
|
|
, docbook_xsl
|
|
|
|
, dbus-glib
|
|
|
|
, libcap_ng
|
|
|
|
, libqb
|
|
|
|
, libseccomp
|
|
|
|
, polkit
|
|
|
|
, protobuf
|
|
|
|
, audit
|
|
|
|
, libgcrypt
|
|
|
|
, libsodium
|
2017-08-26 00:35:18 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert libgcrypt != null -> libsodium == null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-01-15 18:26:47 +01:00
|
|
|
version = "1.0.0";
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "usbguard";
|
2017-08-26 00:35:18 +02:00
|
|
|
|
2021-01-15 18:26:47 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "USBGuard";
|
|
|
|
repo = pname;
|
|
|
|
rev = "usbguard-${version}";
|
|
|
|
sha256 = "sha256-CPuBQmDOpXWn0jPo4HRyDCZUpDy5NmbvUHxXoVbMd/I=";
|
|
|
|
fetchSubmodules = true;
|
2017-08-26 00:35:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-01-15 18:26:47 +01:00
|
|
|
autoreconfHook
|
2021-01-21 23:12:29 +01:00
|
|
|
installShellFiles
|
2019-08-23 21:54:54 +02:00
|
|
|
asciidoc
|
2021-01-19 07:50:56 +01:00
|
|
|
pkg-config
|
2019-06-19 22:29:46 +02:00
|
|
|
libxslt # xsltproc
|
|
|
|
libxml2 # xmllint
|
2019-08-23 21:54:54 +02:00
|
|
|
docbook_xml_dtd_45
|
|
|
|
docbook_xsl
|
2017-08-26 00:35:18 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2018-02-25 03:23:58 +01:00
|
|
|
dbus-glib
|
2017-08-26 00:35:18 +02:00
|
|
|
libcap_ng
|
|
|
|
libqb
|
|
|
|
libseccomp
|
|
|
|
polkit
|
|
|
|
protobuf
|
2018-02-27 19:07:43 +01:00
|
|
|
audit
|
2017-08-26 00:35:18 +02:00
|
|
|
]
|
|
|
|
++ (lib.optional (libgcrypt != null) libgcrypt)
|
2019-08-23 21:54:54 +02:00
|
|
|
++ (lib.optional (libsodium != null) libsodium);
|
2017-08-26 00:35:18 +02:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-bundled-catch"
|
|
|
|
"--with-bundled-pegtl"
|
|
|
|
"--with-dbus"
|
|
|
|
"--with-polkit"
|
|
|
|
]
|
|
|
|
++ (lib.optional (libgcrypt != null) "--with-crypto-library=gcrypt")
|
2019-08-23 21:54:54 +02:00
|
|
|
++ (lib.optional (libsodium != null) "--with-crypto-library=sodium");
|
2017-08-26 00:35:18 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-21 23:12:29 +01:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --bash --name usbguard.bash scripts/bash_completion/usbguard
|
|
|
|
installShellCompletion --zsh --name _usbguard scripts/usbguard-zsh-completion
|
|
|
|
'';
|
|
|
|
|
2021-01-16 23:15:52 +01:00
|
|
|
passthru.tests = nixosTests.usbguard;
|
|
|
|
|
2021-01-15 18:26:47 +01:00
|
|
|
meta = with lib; {
|
2020-10-11 07:55:05 +02:00
|
|
|
description = "The USBGuard software framework helps to protect your computer against BadUSB";
|
2021-01-15 18:26:47 +01:00
|
|
|
longDescription = ''
|
|
|
|
USBGuard is a software framework for implementing USB device authorization
|
|
|
|
policies (what kind of USB devices are authorized) as well as method of
|
|
|
|
use policies (how a USB device may interact with the system). Simply put,
|
|
|
|
it is a USB device whitelisting tool.
|
|
|
|
'';
|
2018-02-27 19:07:43 +01:00
|
|
|
homepage = "https://usbguard.github.io/";
|
2020-12-29 06:45:57 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2017-08-26 00:35:18 +02:00
|
|
|
maintainers = [ maintainers.tnias ];
|
|
|
|
};
|
|
|
|
}
|