1 { lib, stdenv, fetchFromGitHub
2 , openssl, nss, p11-kit
3 , opensc, gnutls, expect
4 , meson, ninja, pkg-config
8 stdenv.mkDerivation rec {
9 pname = "pkcs11-provider";
12 src = fetchFromGitHub {
14 repo = "pkcs11-provider";
16 hash = "sha256-ii2xQPBgqIjrAP27qTQR9IXbEGZcc79M/cYzFwcAajQ=";
19 buildInputs = [ openssl nss p11-kit ];
20 nativeBuildInputs = [ meson ninja pkg-config ];
22 # don't add SoftHSM to here: https://github.com/openssl/openssl/issues/22508
23 nativeCheckInputs = [ p11-kit.bin opensc nss.tools gnutls openssl.bin expect ];
26 patchShebangs --build .
30 # Meson tries to install to `$out/$out` and `$out/''${openssl.out}`; so join them.
32 for dir in "$out" "${openssl.out}"; do
33 mkdir -p .install/"$(dirname -- "$dir")"
34 ln -s "$out" ".install/$dir"
36 export DESTDIR="$(realpath .install)"
39 enableParallelBuilding = true;
41 # Frequently fails due to a race condition.
42 enableParallelInstalling = false;
46 passthru.updateScript = nix-update-script {
47 extraArgs = [ "--version-regex" "v(\d\.\d)"];
51 homepage = "https://github.com/latchset/pkcs11-provider";
52 description = "OpenSSL 3.x provider to access hardware or software tokens using the PKCS#11 Cryptographic Token Interface";
53 maintainers = with maintainers; [ numinit ];
54 license = licenses.asl20;
55 platforms = platforms.unix;