nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 boost,
6 cmake,
7 fftw,
8 fftwSinglePrec,
9 hdf5,
10 libjpeg,
11 libpng,
12 libtiff,
13 openexr,
14 python3,
15 writeShellScript,
16 jq,
17 nix-update,
18}:
19
20let
21 python = python3.withPackages (py: with py; [ numpy ]);
22in
23stdenv.mkDerivation (finalAttrs: {
24 pname = "vigra";
25 version = "1.12.3";
26
27 src = fetchFromGitHub {
28 owner = "ukoethe";
29 repo = "vigra";
30 tag = "Version-${lib.replaceStrings [ "." ] [ "-" ] finalAttrs.version}";
31 hash = "sha256-pknZHHIIhjfOxdp+qCOOGvo0W5ByTHXRiIQzzN7Z6M4=";
32 };
33
34 nativeBuildInputs = [ cmake ];
35 buildInputs = [
36 boost
37 fftw
38 fftwSinglePrec
39 hdf5
40 libjpeg
41 libpng
42 libtiff
43 openexr
44 python
45 ];
46
47 postPatch = ''
48 chmod +x config/run_test.sh.in
49 patchShebangs --build config/run_test.sh.in
50 '';
51
52 cmakeFlags = [
53 "-DWITH_OPENEXR=1"
54 "-DVIGRANUMPY_INSTALL_DIR=${placeholder "out"}/${python.sitePackages}"
55 ]
56 ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
57 "-DCMAKE_CXX_FLAGS=-fPIC"
58 "-DCMAKE_C_FLAGS=-fPIC"
59 ];
60
61 enableParallelBuilding = true;
62
63 passthru = {
64 tests = {
65 check = finalAttrs.finalPackage.overrideAttrs (previousAttrs: {
66 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
67 });
68 };
69 updateScript = writeShellScript "update-vigra" ''
70 latestVersion=$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} --fail --silent https://api.github.com/repos/ukoethe/vigra/releases/latest | ${lib.getExe jq} --raw-output .tag_name | sed -E 's/Version-([0-9]+)-([0-9]+)-([0-9]+)/\1.\2.\3/')
71 ${lib.getExe nix-update} vigra --version $latestVersion
72 '';
73 };
74
75 meta = {
76 description = "Novel computer vision C++ library with customizable algorithms and data structures";
77 mainProgram = "vigra-config";
78 homepage = "https://hci.iwr.uni-heidelberg.de/vigra";
79 license = lib.licenses.mit;
80 maintainers = with lib.maintainers; [
81 ShamrockLee
82 kyehn
83 ];
84 platforms = lib.platforms.unix;
85 };
86})