2021-01-15 22:18:51 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
2021-02-05 17:12:51 +00:00
|
|
|
, installShellFiles
|
|
|
|
, nixosTests
|
2021-01-15 22:18:51 +00:00
|
|
|
, asciidoc
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2021-01-15 22:18:51 +00:00
|
|
|
, libxslt
|
|
|
|
, libxml2
|
|
|
|
, docbook_xml_dtd_45
|
|
|
|
, docbook_xsl
|
|
|
|
, dbus-glib
|
|
|
|
, libcap_ng
|
|
|
|
, libqb
|
|
|
|
, libseccomp
|
|
|
|
, polkit
|
|
|
|
, protobuf
|
|
|
|
, audit
|
|
|
|
, libgcrypt
|
|
|
|
, libsodium
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert libgcrypt != null -> libsodium == null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-03-05 16:20:37 +00:00
|
|
|
version = "1.1.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "usbguard";
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "USBGuard";
|
|
|
|
repo = pname;
|
|
|
|
rev = "usbguard-${version}";
|
2022-03-05 16:20:37 +00:00
|
|
|
sha256 = "sha256-lnHeU/X/2N81WPLakRYLs8TjpBhxBPhiXDJ+wNW0sU0=";
|
2021-01-15 22:18:51 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-01-15 22:18:51 +00:00
|
|
|
autoreconfHook
|
2021-02-05 17:12:51 +00:00
|
|
|
installShellFiles
|
2020-04-24 23:36:52 +00:00
|
|
|
asciidoc
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
libxslt # xsltproc
|
|
|
|
libxml2 # xmllint
|
|
|
|
docbook_xml_dtd_45
|
|
|
|
docbook_xsl
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
dbus-glib
|
|
|
|
libcap_ng
|
|
|
|
libqb
|
|
|
|
libseccomp
|
|
|
|
polkit
|
|
|
|
protobuf
|
|
|
|
audit
|
|
|
|
]
|
|
|
|
++ (lib.optional (libgcrypt != null) libgcrypt)
|
|
|
|
++ (lib.optional (libsodium != null) libsodium);
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --bash --name usbguard.bash scripts/bash_completion/usbguard
|
|
|
|
installShellCompletion --zsh --name _usbguard scripts/usbguard-zsh-completion
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests = nixosTests.usbguard;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "The USBGuard software framework helps to protect your computer against BadUSB";
|
2021-01-15 22:18:51 +00: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.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://usbguard.github.io/";
|
2020-12-29 15:07:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.tnias ];
|
|
|
|
};
|
|
|
|
}
|