2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, openssl
|
|
|
|
, libusb1
|
|
|
|
, libedit
|
|
|
|
, curl
|
|
|
|
, gengetopt
|
|
|
|
, pkg-config
|
|
|
|
, pcsclite
|
|
|
|
, help2man
|
2023-02-09 11:40:11 +00:00
|
|
|
, darwin
|
|
|
|
, libiconv
|
2022-05-18 14:49:53 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "yubihsm-shell";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.5.0";
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Yubico";
|
|
|
|
repo = "yubihsm-shell";
|
|
|
|
rev = version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-QTDFL/UTnnG0TuojJ0eVKw8fNEqZz86CXWb6uHvzUbs=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00: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-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
cmake
|
|
|
|
help2man
|
|
|
|
gengetopt
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libusb1
|
|
|
|
libedit
|
|
|
|
curl
|
|
|
|
openssl
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
2024-09-19 14:19:46 +00:00
|
|
|
pcsclite.dev
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-02-09 11:40:11 +00:00
|
|
|
darwin.apple_sdk.frameworks.PCSC
|
|
|
|
libiconv
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
preBuild = lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-09-19 14:19:46 +00:00
|
|
|
NIX_CFLAGS_COMPILE="$(pkg-config --cflags libpcsclite) $NIX_CFLAGS_COMPILE"
|
|
|
|
'';
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-02-09 11:40:11 +00:00
|
|
|
"-DDISABLE_LTO=ON"
|
|
|
|
];
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# causes redefinition of _FORTIFY_SOURCE
|
|
|
|
hardeningDisable = [ "fortify3" ];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "yubihsm-shell and libyubihsm";
|
|
|
|
homepage = "https://github.com/Yubico/yubihsm-shell";
|
|
|
|
maintainers = with maintainers; [ matthewcroughan ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|