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