fork
Configure Feed
Select the types of activity you want to include in your feed.
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{
2 lib,
3 stdenv,
4 fetchurl,
5 cmake,
6 pkg-config,
7 hidapi,
8 libcbor,
9 openssl,
10 udev,
11 udevCheckHook,
12 zlib,
13 withPcsclite ? true,
14 pcsclite,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "libfido2";
19 version = "1.16.0";
20
21 # releases on https://developers.yubico.com/libfido2/Releases/ are signed
22 src = fetchurl {
23 url = "https://developers.yubico.com/${pname}/Releases/${pname}-${version}.tar.gz";
24 hash = "sha256-jCtvsnm1tC6aySrecYMuSFhSZHtTYHxDuqr7vOzqBOQ=";
25 };
26
27 nativeBuildInputs = [
28 cmake
29 pkg-config
30 udevCheckHook
31 ];
32
33 buildInputs = [
34 libcbor
35 zlib
36 ]
37 ++ lib.optionals stdenv.hostPlatform.isDarwin [ hidapi ]
38 ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ]
39 ++ lib.optionals (stdenv.hostPlatform.isLinux && withPcsclite) [ pcsclite ];
40
41 propagatedBuildInputs = [ openssl ];
42
43 outputs = [
44 "out"
45 "dev"
46 "man"
47 ];
48
49 doInstallCheck = true;
50
51 # Required for FreeBSD
52 # https://github.com/freebsd/freebsd-ports/blob/21a6f0f5829384117dfc1ed11ad67954562ef7d6/security/libfido2/Makefile#L37C27-L37C77
53 postPatch = ''
54 substituteInPlace CMakeLists.txt --replace-fail "-D_POSIX_C_SOURCE=200809L" "-D_POSIX_C_SOURCE=202405L"
55 '';
56
57 cmakeFlags = [
58 "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d"
59 "-DCMAKE_INSTALL_LIBDIR=lib"
60 ]
61 ++ lib.optionals stdenv.hostPlatform.isDarwin [
62 "-DUSE_HIDAPI=1"
63 ]
64 ++ lib.optionals stdenv.hostPlatform.isLinux [
65 "-DNFC_LINUX=1"
66 ]
67 ++ lib.optionals (stdenv.hostPlatform.isLinux && withPcsclite) [
68 "-DUSE_PCSC=1"
69 ];
70
71 # causes possible redefinition of _FORTIFY_SOURCE?
72 hardeningDisable = [ "fortify3" ];
73
74 meta = {
75 description = ''
76 Provides library functionality for FIDO 2.0, including communication with a device over USB.
77 '';
78 homepage = "https://github.com/Yubico/libfido2";
79 license = lib.licenses.bsd2;
80 maintainers = with lib.maintainers; [ prusnak ];
81 platforms = lib.platforms.unix;
82 };
83}