nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 python3,
6 perl,
7 blast,
8 autoPatchelfHook,
9 zlib,
10 bzip2,
11 glib,
12 libxml2,
13 coreutils,
14 sqlite,
15}:
16let
17 pname = "blast-bin";
18 version = "2.16.0";
19
20 srcs = {
21 x86_64-linux = fetchurl {
22 url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${version}/ncbi-blast-${version}+-x64-linux.tar.gz";
23 hash = "sha256-sLEwmMkB0jsyStFwDnRxu3QIp/f1F9dNX6rXEb526PQ=";
24 };
25 aarch64-linux = fetchurl {
26 url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${version}/ncbi-blast-${version}+-aarch64-linux.tar.gz";
27 hash = "sha256-1EeiMu08R9Glq8qRky4OTT5lQPLJcM7iaqUrmUOS4MI=";
28 };
29 x86_64-darwin = fetchurl {
30 url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${version}/ncbi-blast-${version}+-x64-macosx.tar.gz";
31 hash = "sha256-fu4edyD12q8G452ckrEl2Qct5+uB9JnABd7bCLkyMkw=";
32 };
33 aarch64-darwin = fetchurl {
34 url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${version}/ncbi-blast-${version}+-aarch64-macosx.tar.gz";
35 hash = "sha256-6NpPNLBCHaBRscLZ5fjh5Dv3bjjPk2Gh2+L7xEtiJNs=";
36 };
37 };
38 src = srcs.${stdenv.hostPlatform.system};
39in
40stdenv.mkDerivation {
41 inherit pname version src;
42
43 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
44
45 buildInputs = [
46 python3
47 perl
48 ]
49 ++ lib.optionals stdenv.hostPlatform.isLinux [
50 zlib
51 bzip2
52 glib
53 libxml2
54 sqlite
55 ];
56
57 installPhase = ''
58 runHook preInstall
59
60 install -Dm755 bin/* -t $out/bin
61
62 runHook postInstall
63 '';
64
65 preFixup = ''
66 substituteInPlace $out/bin/get_species_taxids.sh \
67 --replace /bin/rm ${coreutils}/bin/rm
68 '';
69
70 meta = with lib; {
71 inherit (blast.meta) description homepage license;
72 platforms = [
73 "x86_64-linux"
74 "aarch64-linux"
75 "x86_64-darwin"
76 "aarch64-darwin"
77 ];
78 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
79 maintainers = with maintainers; [ natsukium ];
80 };
81}