1{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, libgcrypt }:
2
3stdenv.mkDerivation rec {
4 pname = "libcotp";
5 version = "2.0.1";
6
7 src = fetchFromGitHub {
8 owner = "paolostivanin";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-w0DxZLEuR9m7udmlBQ7TyCoQvGVmJCffKHsxynQV+oo=";
12 };
13
14 postPatch = lib.optionalString stdenv.cc.isClang ''
15 substituteInPlace CMakeLists.txt \
16 --replace "add_link_options(-Wl," "# add_link_options(-Wl,"
17 '';
18
19 buildInputs = [ libgcrypt ];
20 nativeBuildInputs = [ cmake pkg-config ];
21
22 meta = with lib; {
23 description = "C library that generates TOTP and HOTP";
24 homepage = "https://github.com/paolostivanin/libcotp";
25 license = licenses.asl20;
26 maintainers = with maintainers; [ alexbakker ];
27 platforms = platforms.all;
28 };
29}