Commit dab389b7 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

hap-py: cleanup, fix cmake 4 compatibility

parent 7e09866f
Loading
Loading
Loading
Loading
+27 −13
Original line number Diff line number Diff line
@@ -37,22 +37,26 @@ let
    ];
  my-python = python3.withPackages my-python-packages;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "hap.py";
  version = "0.3.15";

  src = fetchFromGitHub {
    owner = "Illumina";
    repo = "hap.py";
    rev = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-K8XXhioMGMHw56MKvp0Eo8S6R36JczBzGRaBz035zRQ=";
  };
  # For illumina script
  BOOST_ROOT = "${boost.out}";
  ZLIBSTATIC = "${zlib.static}";
  # For cmake : boost lib and includedir are in different location
  BOOST_LIBRARYDIR = "${boost.out}/lib";
  BOOST_INCLUDEDIR = "${boost.dev}/include";

  # CMake 4 dropped support of versions lower than 3.5,
  # versions lower than 3.10 are deprecated.
  # https://github.com/NixOS/nixpkgs/issues/445447
  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail \
        "cmake_minimum_required (VERSION 2.8)" \
        "cmake_minimum_required (VERSION 3.10)"
  '';

  patches = [
    # Compatibility with nix for boost and library flags : zlib, bzip2, curl, crypto, lzma
@@ -76,17 +80,27 @@ stdenv.mkDerivation rec {
    zlib
  ];

  env = {
    # For illumina script
    BOOST_ROOT = "${boost.out}";
    ZLIBSTATIC = "${zlib.static}";

    # For cmake : boost lib and includedir are in different location
    BOOST_LIBRARYDIR = "${boost.out}/lib";
    BOOST_INCLUDEDIR = "${boost.dev}/include";
  };

  postFixup = ''
    wrapProgram $out/bin/hap.py \
       --set PATH ${lib.makeBinPath runtime} \
       --add-flags "--engine-vcfeval-path=${rtg-tools}/bin/rtg"
       --add-flags "--engine-vcfeval-path=${lib.getExe rtg-tools}"
  '';

  meta = with lib; {
  meta = {
    description = "Compare genetics variants against a gold dataset";
    homepage = "https://github.com/Illumina/hap.py";
    license = licenses.bsd2;
    maintainers = with maintainers; [ apraga ];
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ apraga ];
    mainProgram = "hap.py";
  };
}
})