libnvme: fix musl build

This commit is contained in:
Jörg Thalheim 2023-10-28 11:45:48 +02:00 committed by Jörg Thalheim
parent 4002cdeba2
commit d44b7c3c7c

View File

@ -11,11 +11,12 @@
, stdenv , stdenv
, swig , swig
, systemd , systemd
, fetchpatch
# ImportError: cannot import name 'mlog' from 'mesonbuild' # ImportError: cannot import name 'mlog' from 'mesonbuild'
, withDocs ? stdenv.hostPlatform.canExecute stdenv.buildPlatform , withDocs ? stdenv.hostPlatform.canExecute stdenv.buildPlatform
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "libnvme"; pname = "libnvme";
version = "1.6"; version = "1.6";
@ -24,10 +25,18 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "linux-nvme"; owner = "linux-nvme";
repo = "libnvme"; repo = "libnvme";
rev = "v${version}"; rev = "v${finalAttrs.version}";
hash = "sha256-7bvjsmt16/6RycSDKIECtJ4ES7NTaspU6IMpUw0sViA="; hash = "sha256-7bvjsmt16/6RycSDKIECtJ4ES7NTaspU6IMpUw0sViA=";
}; };
patches = [
# included in next release
(fetchpatch {
url = "https://github.com/linux-nvme/libnvme/commit/ff742e792725c316ba6de0800188bf36751bd1d1.patch";
hash = "sha256-IUjPUBmGQC4oAKFFlBrjonqD2YdyNPC9siK4t/t2slE=";
})
];
postPatch = '' postPatch = ''
patchShebangs scripts patchShebangs scripts
''; '';
@ -51,6 +60,7 @@ stdenv.mkDerivation rec {
mesonFlags = [ mesonFlags = [
"-Ddocs=man" "-Ddocs=man"
(lib.mesonBool "tests" finalAttrs.doCheck)
(lib.mesonBool "docs-build" withDocs) (lib.mesonBool "docs-build" withDocs)
]; ];
@ -58,7 +68,8 @@ stdenv.mkDerivation rec {
export KBUILD_BUILD_TIMESTAMP="$(date -u -d @$SOURCE_DATE_EPOCH)" export KBUILD_BUILD_TIMESTAMP="$(date -u -d @$SOURCE_DATE_EPOCH)"
''; '';
doCheck = true; # mocked ioctl conflicts with the musl one: https://github.com/NixOS/nixpkgs/pull/263768#issuecomment-1782877974
doCheck = !stdenv.hostPlatform.isMusl;
meta = with lib; { meta = with lib; {
description = "C Library for NVM Express on Linux"; description = "C Library for NVM Express on Linux";
@ -67,4 +78,4 @@ stdenv.mkDerivation rec {
license = with licenses; [ lgpl21Plus ]; license = with licenses; [ lgpl21Plus ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
} })