Commit d44b7c3c authored by Jörg Thalheim's avatar Jörg Thalheim
Browse files

libnvme: fix musl build

parent 4002cdeb
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -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;
  };
}
})