nixpkgs/pkgs/tools/security/yubihsm-shell/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.4 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, cmake
, openssl
, libusb1
, libedit
, curl
, gengetopt
, pkg-config
, pcsclite
, help2man
2023-02-06 12:56:21 +01:00
, darwin
, libiconv
}:
stdenv.mkDerivation rec {
pname = "yubihsm-shell";
2023-11-16 12:17:58 +01:00
version = "2.4.2";
src = fetchFromGitHub {
owner = "Yubico";
repo = "yubihsm-shell";
rev = version;
2023-11-16 12:17:58 +01:00
hash = "sha256-Un3DNmrD9aC9+A3+NNM21yrH1g14THXPHkJ0SUYrL/M=";
};
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"
'';
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
];
2023-02-06 12:56:21 +01:00
cmakeFlags = lib.optionals stdenv.isDarwin [
"-DDISABLE_LTO=ON"
];
# causes redefinition of _FORTIFY_SOURCE
hardeningDisable = [ "fortify3" ];
meta = with lib; {
description = "yubihsm-shell and libyubihsm";
homepage = "https://github.com/Yubico/yubihsm-shell";
maintainers = with maintainers; [ matthewcroughan ];
license = licenses.asl20;
};
}