nixpkgs/pkgs/by-name/ht/htslib/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

53 lines
1.5 KiB
Nix

{ lib, stdenv, fetchurl, zlib, bzip2, xz, curl, perl }:
stdenv.mkDerivation rec {
pname = "htslib";
version = "1.19.1";
src = fetchurl {
url = "https://github.com/samtools/htslib/releases/download/${version}/${pname}-${version}.tar.bz2";
sha256 = "sha256-Ii1001dPtnsVjGmIyYDuqrqKBlb15P+3a1+lfwNZM+w=";
};
# perl is only used during the check phase.
nativeBuildInputs = [ perl ];
buildInputs = [ zlib bzip2 xz curl ];
configureFlags = if ! stdenv.hostPlatform.isStatic
then [ "--enable-libcurl" ] # optional but strongly recommended
else [ "--disable-libcurl" "--disable-plugins" ];
# In the case of static builds, we need to replace the build and install phases
buildPhase = lib.optional stdenv.hostPlatform.isStatic ''
make AR=$AR lib-static
make LDFLAGS=-static bgzip htsfile tabix
'';
installPhase = lib.optional stdenv.hostPlatform.isStatic ''
install -d $out/bin
install -d $out/lib
install -d $out/include/htslib
install -D libhts.a $out/lib
install -m644 htslib/*h $out/include/htslib
install -D bgzip htsfile tabix $out/bin
'';
preCheck = ''
patchShebangs test/
'';
enableParallelBuilding = true;
doCheck = true;
meta = with lib; {
description = "C library for reading/writing high-throughput sequencing data";
license = licenses.mit;
homepage = "http://www.htslib.org/";
platforms = platforms.unix;
maintainers = [ maintainers.mimame ];
};
}