mrtrix: 3.0.4 -> 3.0.4-unstable-2025-04-09 (#397641)

authored by

Peder Bergebakken Sundt and committed by
GitHub
2d2805b3 3a7dc008

+68 -16
+68 -16
pkgs/applications/science/biology/mrtrix/default.nix
··· 18 18 libXext, 19 19 less, 20 20 withGui ? true, 21 + fetchFromGitLab, 22 + fetchpatch, 21 23 }: 22 24 25 + let 26 + # reverts 'eigen: 3.4.0 -> 3.4.0-unstable-2022-05-19' 27 + # https://github.com/NixOS/nixpkgs/commit/d298f046edabc84b56bd788e11eaf7ed72f8171c 28 + eigen' = ( 29 + eigen.overrideAttrs (old: rec { 30 + version = "3.4.0"; 31 + src = fetchFromGitLab { 32 + owner = "libeigen"; 33 + repo = "eigen"; 34 + tag = version; 35 + hash = "sha256-1/4xMetKMDOgZgzz3WMxfHUEpmdAm52RqZvz6i0mLEw="; 36 + }; 37 + patches = (old.patches or [ ]) ++ [ 38 + # Fixes e.g. onnxruntime on aarch64-darwin: 39 + # https://hydra.nixos.org/build/248915128/nixlog/1, 40 + # originally suggested in https://github.com/NixOS/nixpkgs/pull/258392. 41 + # 42 + # The patch is from 43 + # ["Fix vectorized reductions for Eigen::half"](https://gitlab.com/libeigen/eigen/-/merge_requests/699) 44 + # which is two years old, 45 + # but Eigen hasn't had a release in two years either: 46 + # https://gitlab.com/libeigen/eigen/-/issues/2699. 47 + (fetchpatch { 48 + url = "https://gitlab.com/libeigen/eigen/-/commit/d0e3791b1a0e2db9edd5f1d1befdb2ac5a40efe0.patch"; 49 + hash = "sha256-8qiNpuYehnoiGiqy0c3Mcb45pwrmc6W4rzCxoLDSvj0="; 50 + }) 51 + ]; 52 + }) 53 + ); 54 + in 55 + 23 56 stdenv.mkDerivation rec { 24 57 pname = "mrtrix"; 25 - version = "3.0.4"; 58 + version = "3.0.4-unstable-2025-04-09"; 26 59 27 60 src = fetchFromGitHub { 28 61 owner = "MRtrix3"; 29 62 repo = "mrtrix3"; 30 - tag = version; 31 - hash = "sha256-87zBAoBLWQPccGS37XyQ8H0GhL01k8GQFgcLL6IwbcM="; 63 + rev = "7843bfc53a75f465901804ccf3fd6797d77531dd"; 64 + hash = "sha256-C4Io3VkX10eWia4djrYvN12fWmwm0j1G60I8lmFH49w="; 32 65 fetchSubmodules = true; 33 66 }; 34 67 35 68 nativeBuildInputs = [ 36 - eigen 37 69 makeWrapper 70 + less 71 + python 38 72 ] ++ lib.optional withGui qt5.wrapQtAppsHook; 39 73 40 74 buildInputs = 41 75 [ 42 76 ants 77 + eigen' 43 78 python 44 79 fftw 45 80 libtiff ··· 58 93 nativeInstallCheckInputs = [ bc ]; 59 94 60 95 postPatch = '' 61 - patchShebangs ./build ./configure ./run_tests ./bin/* 96 + patchShebangs --build ./build ./configure ./run_tests 97 + patchShebangs --host ./bin/* 62 98 63 99 # patching interpreters before fixup is needed for tests: 64 - patchShebangs ./bin/* 65 100 patchShebangs testing/binaries/data/vectorstats/*py 66 101 67 102 substituteInPlace ./run_tests \ 68 - --replace 'git submodule update --init $datadir >> $LOGFILE 2>&1' "" 103 + --replace-fail 'git submodule update --init $datadir >> $LOGFILE 2>&1' "" 104 + 105 + # reduce build noise 106 + substituteInPlace ./configure \ 107 + --replace-fail "[ '-Wall' ]" "[]" 69 108 109 + # fix error output (cuts off after a few lines otherwise) 70 110 substituteInPlace ./build \ 71 - --replace '"less -RX "' '"${less}/bin/less -RX "' 111 + --replace-fail 'stderr=subprocess.PIPE' 'stderr=None' 72 112 ''; 73 113 74 114 configurePhase = '' 75 - export EIGEN_CFLAGS="-isystem ${eigen}/include/eigen3" 115 + runHook preConfigure 116 + export EIGEN_CFLAGS="-isystem ${eigen'}/include/eigen3" 76 117 unset LD # similar to https://github.com/MRtrix3/mrtrix3/issues/1519 77 118 ./configure ${lib.optionalString (!withGui) "-nogui"}; 119 + runHook postConfigure 78 120 ''; 79 121 80 122 buildPhase = '' 123 + runHook preBuild 81 124 ./build 82 125 (cd testing && ../build) 126 + runHook postBuild 83 127 ''; 84 128 85 129 installCheckPhase = '' 130 + runHook preInstallCheck 86 131 ./run_tests units 87 132 ./run_tests binaries 88 133 89 134 # can also `./run_tests scripts`, but this fails due to lack of FSL package 90 135 # (and there's no convenient way to disable individual tests) 136 + runHook postInstallCheck 91 137 ''; 92 138 doInstallCheck = true; 93 139 ··· 99 145 runHook postInstall 100 146 ''; 101 147 102 - postInstall = '' 103 - for prog in $out/bin/*; do 104 - if [[ -x "$prog" ]]; then 105 - wrapProgram $prog --prefix PATH : ${lib.makeBinPath [ ants ]} 106 - fi 107 - done 108 - ''; 148 + preFixup = 149 + if withGui then 150 + '' 151 + qtWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ ants ]}) 152 + '' 153 + else 154 + '' 155 + for prog in $out/bin/*; do 156 + if [[ -x "$prog" ]]; then 157 + wrapProgram $prog --prefix PATH : ${lib.makeBinPath [ ants ]} 158 + fi 159 + done 160 + ''; 109 161 110 162 meta = with lib; { 111 163 broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);