btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / li / libfido2 / package.nix
blob1a68b5eb6eb122f70129b648c873474009a4bdbd
1 { lib
2 , stdenv
3 , fetchurl
4 , cmake
5 , pkg-config
6 , hidapi
7 , libcbor
8 , openssl
9 , udev
10 , zlib
11 , withPcsclite ? true
12 , pcsclite
15 stdenv.mkDerivation rec {
16   pname = "libfido2";
17   version = "1.15.0";
19   # releases on https://developers.yubico.com/libfido2/Releases/ are signed
20   src = fetchurl {
21     url = "https://developers.yubico.com/${pname}/Releases/${pname}-${version}.tar.gz";
22     hash = "sha256-q6qxMY0h0mLs5Bb7inEy+pN0vaifb6UrhqmKL1cSth4=";
23   };
25   nativeBuildInputs = [ cmake pkg-config ];
27   buildInputs = [ libcbor zlib ]
28     ++ lib.optionals stdenv.hostPlatform.isDarwin [ hidapi ]
29     ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ]
30     ++ lib.optionals (stdenv.hostPlatform.isLinux && withPcsclite) [ pcsclite ];
32   propagatedBuildInputs = [ openssl ];
34   outputs = [ "out" "dev" "man" ];
36   cmakeFlags = [
37     "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d"
38     "-DCMAKE_INSTALL_LIBDIR=lib"
39   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
40     "-DUSE_HIDAPI=1"
41   ] ++ lib.optionals stdenv.hostPlatform.isLinux [
42     "-DNFC_LINUX=1"
43   ] ++ lib.optionals (stdenv.hostPlatform.isLinux && withPcsclite) [
44     "-DUSE_PCSC=1"
45   ];
47   # causes possible redefinition of _FORTIFY_SOURCE?
48   hardeningDisable = [ "fortify3" ];
50   meta = with lib; {
51     description = ''
52       Provides library functionality for FIDO 2.0, including communication with a device over USB.
53     '';
54     homepage = "https://github.com/Yubico/libfido2";
55     license = licenses.bsd2;
56     maintainers = with maintainers; [ prusnak ];
57     platforms = platforms.unix;
58   };