
It doesn't matter whether the hostPlatform could execute stuff from the buildPlatform - we need it the other way around: Certain things during a build process can only happen when, as part of the build, the **buildPlatform** can execute the code it just created for the **hostPlatform**. Unless we are talking about compilation at run-time, as in the case of PostgreSQL. Extend the comment there to make it clear that this is on purpose. Another case that's OK is vlc, where luac can't cross-compile at build time, thus the bytecode is actually build for the buildPlatform and the sources must be interpreted at runtime instead.
77 lines
1.6 KiB
Nix
77 lines
1.6 KiB
Nix
{
|
|
fetchFromGitHub,
|
|
bash,
|
|
json_c,
|
|
keyutils,
|
|
lib,
|
|
meson,
|
|
ninja,
|
|
openssl,
|
|
perl,
|
|
pkg-config,
|
|
python3,
|
|
stdenv,
|
|
swig,
|
|
systemd,
|
|
# ImportError: cannot import name 'mlog' from 'mesonbuild'
|
|
withDocs ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "libnvme";
|
|
version = "1.11.1";
|
|
|
|
outputs = [ "out" ] ++ lib.optionals withDocs [ "man" ];
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "linux-nvme";
|
|
repo = "libnvme";
|
|
rev = "v${finalAttrs.version}";
|
|
hash = "sha256-CEGr7PDOVRi210XvICH8iLYDKn8S9bGruBO4tycvsT8=";
|
|
};
|
|
|
|
postPatch = ''
|
|
patchShebangs scripts
|
|
substituteInPlace test/sysfs/tree-diff.sh test/config/config-diff.sh \
|
|
--replace-fail /bin/bash ${bash}/bin/bash
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
meson
|
|
ninja
|
|
perl # for kernel-doc
|
|
pkg-config
|
|
python3.pythonOnBuildForHost
|
|
swig
|
|
];
|
|
|
|
buildInputs = [
|
|
keyutils
|
|
json_c
|
|
openssl
|
|
systemd
|
|
python3
|
|
];
|
|
|
|
mesonFlags = [
|
|
"-Ddocs=man"
|
|
(lib.mesonBool "tests" finalAttrs.finalPackage.doCheck)
|
|
(lib.mesonBool "docs-build" withDocs)
|
|
];
|
|
|
|
preConfigure = ''
|
|
export KBUILD_BUILD_TIMESTAMP="$(date -u -d @$SOURCE_DATE_EPOCH)"
|
|
'';
|
|
|
|
# mocked ioctl conflicts with the musl one: https://github.com/NixOS/nixpkgs/pull/263768#issuecomment-1782877974
|
|
doCheck = !stdenv.hostPlatform.isMusl;
|
|
|
|
meta = with lib; {
|
|
description = "C Library for NVM Express on Linux";
|
|
homepage = "https://github.com/linux-nvme/libnvme";
|
|
maintainers = with maintainers; [ vifino ];
|
|
license = with licenses; [ lgpl21Plus ];
|
|
platforms = platforms.linux;
|
|
};
|
|
})
|