1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, hidapi
7, libusb1
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "libnitrokey";
12 version = "3.8";
13
14 src = fetchFromGitHub {
15 owner = "Nitrokey";
16 repo = "libnitrokey";
17 rev = "v${finalAttrs.version}";
18 hash = "sha256-4PEZ31QyVOmdhpKqTN8fwcHoLuu+w+OJ3fZeqwlE+io=";
19 # On OSX, libnitrokey depends on a custom version of hidapi in a submodule.
20 # Monitor https://github.com/Nitrokey/libnitrokey/issues/140 to see if we
21 # can remove this extra work one day.
22 fetchSubmodules = true;
23 };
24
25 nativeBuildInputs = [
26 cmake
27 pkg-config
28 ];
29
30 cmakeFlags = [
31 "-DADD_GIT_INFO=OFF"
32 "-DCMAKE_INSTALL_UDEVRULESDIR=etc/udev/rules.d"
33 ];
34
35 buildInputs = [ libusb1 ];
36
37 propagatedBuildInputs = [ hidapi ];
38
39 meta = with lib; {
40 description = "Communicate with Nitrokey devices in a clean and easy manner";
41 homepage = "https://github.com/Nitrokey/libnitrokey";
42 license = licenses.lgpl3;
43 maintainers = with maintainers; [ panicgh raitobezarius ];
44 };
45})