nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 78 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 zlib, 7 bzip2, 8 xz, 9 curl, 10 perl, 11}: 12 13stdenv.mkDerivation rec { 14 pname = "htslib"; 15 version = "1.22"; 16 17 src = fetchurl { 18 url = "https://github.com/samtools/htslib/releases/download/${version}/${pname}-${version}.tar.bz2"; 19 hash = "sha256-YlDB3yl9tHdRbmCsjfRe11plLR8lsPN/EvWxcmnq/ek="; 20 }; 21 22 patches = [ 23 (fetchpatch { 24 url = "https://github.com/samtools/htslib/commit/31006e1c8edd02eb6321ed9be76b84fca5d20cb6.patch"; 25 hash = "sha256-sbnkVmXIbs/Cn/msUUrJpJZCI2DHX5kpGSka2cccZIQ="; 26 }) 27 ]; 28 29 # perl is only used during the check phase. 30 nativeBuildInputs = [ perl ]; 31 32 buildInputs = [ 33 zlib 34 bzip2 35 xz 36 curl 37 ]; 38 39 configureFlags = 40 if !stdenv.hostPlatform.isStatic then 41 [ "--enable-libcurl" ] # optional but strongly recommended 42 else 43 [ 44 "--disable-libcurl" 45 "--disable-plugins" 46 ]; 47 48 # In the case of static builds, we need to replace the build and install phases 49 buildPhase = lib.optional stdenv.hostPlatform.isStatic '' 50 make AR=$AR lib-static 51 make LDFLAGS=-static bgzip htsfile tabix 52 ''; 53 54 installPhase = lib.optional stdenv.hostPlatform.isStatic '' 55 install -d $out/bin 56 install -d $out/lib 57 install -d $out/include/htslib 58 install -D libhts.a $out/lib 59 install -m644 htslib/*h $out/include/htslib 60 install -D bgzip htsfile tabix $out/bin 61 ''; 62 63 preCheck = '' 64 patchShebangs test/ 65 ''; 66 67 enableParallelBuilding = true; 68 69 doCheck = true; 70 71 meta = with lib; { 72 description = "C library for reading/writing high-throughput sequencing data"; 73 license = licenses.mit; 74 homepage = "http://www.htslib.org/"; 75 platforms = platforms.unix; 76 maintainers = [ maintainers.mimame ]; 77 }; 78}