1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 makeWrapper,
7 flex,
8 bison,
9 perl,
10 TextFormat,
11 libminc,
12 libjpeg,
13 nifticlib,
14 zlib,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "minc-tools";
19 version = "2.3.06-unstable-2023-08-12";
20
21 src = fetchFromGitHub {
22 owner = "BIC-MNI";
23 repo = pname;
24 rev = "c86a767dbb63aaa05ee981306fa09f6133bde427";
25 hash = "sha256-PLNcuDU0ht1PcjloDhrPzpOpE42gbhPP3rfHtP7WnM4=";
26 };
27
28 nativeBuildInputs = [
29 cmake
30 flex
31 bison
32 makeWrapper
33 ];
34
35 buildInputs = [
36 libminc
37 libjpeg
38 nifticlib
39 zlib
40 ];
41
42 propagatedBuildInputs = [
43 perl
44 TextFormat
45 ];
46
47 cmakeFlags = [
48 "-DLIBMINC_DIR=${libminc}/lib/cmake"
49 "-DZNZ_INCLUDE_DIR=${nifticlib}/include/nifti"
50 "-DNIFTI_INCLUDE_DIR=${nifticlib}/include/nifti"
51 ];
52
53 env.NIX_CFLAGS_COMPILE = "-D_FillValue=NC_FillValue";
54
55 postFixup = ''
56 for prog in minccomplete minchistory mincpik; do
57 wrapProgram $out/bin/$prog --prefix PERL5LIB : $PERL5LIB
58 done
59 '';
60
61 meta = with lib; {
62 homepage = "https://github.com/BIC-MNI/minc-tools";
63 description = "Command-line utilities for working with MINC files";
64 maintainers = with maintainers; [ bcdarwin ];
65 platforms = platforms.unix;
66 license = licenses.free;
67 broken = stdenv.hostPlatform.isDarwin;
68 };
69}