2022-04-21 23:44:30 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, openssl
|
|
|
|
, libusb1
|
|
|
|
, libedit
|
|
|
|
, curl
|
|
|
|
, gengetopt
|
|
|
|
, pkg-config
|
|
|
|
, pcsclite
|
|
|
|
, help2man
|
2023-02-06 12:56:21 +01:00
|
|
|
, darwin
|
|
|
|
, libiconv
|
2022-04-21 23:44:30 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "yubihsm-shell";
|
2023-11-16 12:17:58 +01:00
|
|
|
version = "2.4.2";
|
2022-04-21 23:44:30 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Yubico";
|
|
|
|
repo = "yubihsm-shell";
|
|
|
|
rev = version;
|
2023-11-16 12:17:58 +01:00
|
|
|
hash = "sha256-Un3DNmrD9aC9+A3+NNM21yrH1g14THXPHkJ0SUYrL/M=";
|
2022-04-21 23:44:30 +02:00
|
|
|
};
|
|
|
|
|
2023-02-06 12:56:21 +01:00
|
|
|
postPatch = ''
|
|
|
|
# Can't find libyubihsm at runtime because of dlopen() in C code
|
|
|
|
substituteInPlace lib/yubihsm.c \
|
|
|
|
--replace "libyubihsm_usb.so" "$out/lib/libyubihsm_usb.so" \
|
|
|
|
--replace "libyubihsm_http.so" "$out/lib/libyubihsm_http.so"
|
|
|
|
# ld: unknown option: -z
|
|
|
|
substituteInPlace CMakeLists.txt cmake/SecurityFlags.cmake \
|
|
|
|
--replace "AppleClang" "Clang"
|
|
|
|
'';
|
|
|
|
|
2022-04-21 23:44:30 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
cmake
|
|
|
|
help2man
|
|
|
|
gengetopt
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libusb1
|
|
|
|
libedit
|
|
|
|
curl
|
|
|
|
openssl
|
2023-02-06 12:56:21 +01:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
pcsclite
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.PCSC
|
|
|
|
libiconv
|
2022-04-21 23:44:30 +02:00
|
|
|
];
|
|
|
|
|
2023-02-06 12:56:21 +01:00
|
|
|
cmakeFlags = lib.optionals stdenv.isDarwin [
|
|
|
|
"-DDISABLE_LTO=ON"
|
|
|
|
];
|
2022-04-21 23:44:30 +02:00
|
|
|
|
2023-07-09 19:48:20 +02:00
|
|
|
# causes redefinition of _FORTIFY_SOURCE
|
|
|
|
hardeningDisable = [ "fortify3" ];
|
|
|
|
|
2022-04-21 23:44:30 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "yubihsm-shell and libyubihsm";
|
|
|
|
homepage = "https://github.com/Yubico/yubihsm-shell";
|
|
|
|
maintainers = with maintainers; [ matthewcroughan ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|