From d44b7c3c7c27ce6bf17284d3d10f898e6590aff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 28 Oct 2023 11:45:48 +0200 Subject: [PATCH] libnvme: fix musl build --- pkgs/os-specific/linux/libnvme/default.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/libnvme/default.nix b/pkgs/os-specific/linux/libnvme/default.nix index 9ab3c7275a22..564fa4537c8f 100644 --- a/pkgs/os-specific/linux/libnvme/default.nix +++ b/pkgs/os-specific/linux/libnvme/default.nix @@ -11,11 +11,12 @@ , stdenv , swig , systemd +, fetchpatch # ImportError: cannot import name 'mlog' from 'mesonbuild' , withDocs ? stdenv.hostPlatform.canExecute stdenv.buildPlatform }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libnvme"; version = "1.6"; @@ -24,10 +25,18 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "linux-nvme"; repo = "libnvme"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; 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 = '' patchShebangs scripts ''; @@ -51,6 +60,7 @@ stdenv.mkDerivation rec { mesonFlags = [ "-Ddocs=man" + (lib.mesonBool "tests" finalAttrs.doCheck) (lib.mesonBool "docs-build" withDocs) ]; @@ -58,7 +68,8 @@ stdenv.mkDerivation rec { 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; { description = "C Library for NVM Express on Linux"; @@ -67,4 +78,4 @@ stdenv.mkDerivation rec { license = with licenses; [ lgpl21Plus ]; platforms = platforms.linux; }; -} +})