2022-10-06 18:32:54 +00:00
|
|
|
{ fetchFromGitHub
|
2024-06-20 14:57:18 +00:00
|
|
|
, bash
|
2022-10-06 18:32:54 +00:00
|
|
|
, json_c
|
2023-04-29 16:46:19 +00:00
|
|
|
, keyutils
|
2022-10-06 18:32:54 +00:00
|
|
|
, lib
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, openssl
|
|
|
|
, perl
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, stdenv
|
2023-04-29 16:46:19 +00:00
|
|
|
, swig
|
2022-10-06 18:32:54 +00:00
|
|
|
, systemd
|
2023-10-09 19:29:22 +00:00
|
|
|
# ImportError: cannot import name 'mlog' from 'mesonbuild'
|
|
|
|
, withDocs ? stdenv.hostPlatform.canExecute stdenv.buildPlatform
|
2022-10-06 18:32:54 +00:00
|
|
|
}:
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-10-06 18:32:54 +00:00
|
|
|
pname = "libnvme";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "1.9";
|
2022-10-06 18:32:54 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
outputs = [ "out" ] ++ lib.optionals withDocs [ "man" ];
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "linux-nvme";
|
|
|
|
repo = "libnvme";
|
2023-11-16 04:20:00 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-nXzYbj4BDxFii30yR+aTgqjQfyYMFiAIcV/OHI2y5Ws=";
|
2022-10-06 18:32:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
patchShebangs scripts
|
2024-06-20 14:57:18 +00:00
|
|
|
substituteInPlace test/sysfs/sysfs-tree-diff.sh \
|
|
|
|
--replace-fail /bin/bash ${bash}/bin/bash
|
2022-10-06 18:32:54 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
perl # for kernel-doc
|
|
|
|
pkg-config
|
2023-11-16 04:20:00 +00:00
|
|
|
python3.pythonOnBuildForHost
|
2023-04-29 16:46:19 +00:00
|
|
|
swig
|
2022-10-06 18:32:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-04-29 16:46:19 +00:00
|
|
|
keyutils
|
2022-10-06 18:32:54 +00:00
|
|
|
json_c
|
|
|
|
openssl
|
|
|
|
systemd
|
2023-04-29 16:46:19 +00:00
|
|
|
python3
|
2022-10-06 18:32:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Ddocs=man"
|
2024-01-02 11:29:13 +00:00
|
|
|
(lib.mesonBool "tests" finalAttrs.finalPackage.doCheck)
|
2023-10-09 19:29:22 +00:00
|
|
|
(lib.mesonBool "docs-build" withDocs)
|
2022-10-06 18:32:54 +00:00
|
|
|
];
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
preConfigure = ''
|
|
|
|
export KBUILD_BUILD_TIMESTAMP="$(date -u -d @$SOURCE_DATE_EPOCH)"
|
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# mocked ioctl conflicts with the musl one: https://github.com/NixOS/nixpkgs/pull/263768#issuecomment-1782877974
|
|
|
|
doCheck = !stdenv.hostPlatform.isMusl;
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "C Library for NVM Express on Linux";
|
|
|
|
homepage = "https://github.com/linux-nvme/libnvme";
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ vifino ];
|
2022-10-06 18:32:54 +00:00
|
|
|
license = with licenses; [ lgpl21Plus ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
2023-11-16 04:20:00 +00:00
|
|
|
})
|