nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 zlib,
6 htslib,
7 perl,
8 ncurses ? null,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "samtools";
13 version = "1.22.1";
14
15 src = fetchurl {
16 url = "https://github.com/samtools/samtools/releases/download/${version}/${pname}-${version}.tar.bz2";
17 hash = "sha256-Aqpc0LpS4GwggAVOBZ19d6iF3+lxfDHNid/npAR+2g4=";
18 };
19
20 # tests require `bgzip` from the htslib package
21 nativeCheckInputs = [ htslib ];
22
23 nativeBuildInputs = [ perl ];
24
25 buildInputs = [
26 zlib
27 ncurses
28 htslib
29 ];
30
31 preConfigure = lib.optional stdenv.hostPlatform.isStatic ''
32 export LIBS="-lz -lbz2 -llzma"
33 '';
34 makeFlags = lib.optional stdenv.hostPlatform.isStatic "AR=${stdenv.cc.targetPrefix}ar";
35
36 configureFlags = [
37 "--with-htslib=${htslib}"
38 ]
39 ++ lib.optional (ncurses == null) "--without-curses"
40 ++ lib.optionals stdenv.hostPlatform.isStatic [ "--without-curses" ];
41
42 preCheck = ''
43 patchShebangs test/
44 '';
45
46 enableParallelBuilding = true;
47
48 doCheck = true;
49
50 meta = {
51 description = "Tools for manipulating SAM/BAM/CRAM format";
52 license = lib.licenses.mit;
53 homepage = "http://www.htslib.org/";
54 platforms = lib.platforms.unix;
55 maintainers = with lib.maintainers; [
56 mimame
57 unode
58 ];
59 };
60}