1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6
7 autoreconfHook,
8 bzip2,
9 cfitsio,
10 exiv2,
11 gettext,
12 gtk2,
13 gtkimageview,
14 lcms2,
15 lensfun,
16 libjpeg,
17 libtiff,
18 perl,
19 pkg-config,
20 zlib,
21
22 addThumbnailer ? false,
23}:
24
25stdenv.mkDerivation rec {
26 pname = "nufraw";
27 version = "0.43-3";
28
29 src = fetchurl {
30 url = "mirror://sourceforge/nufraw/nufraw-${version}.tar.gz";
31 sha256 = "0b63qvw9r8kaqw36bk3a9zwxc41h8fr6498indkw4glrj0awqz9c";
32 };
33
34 nativeBuildInputs = [
35 autoreconfHook
36 gettext
37 perl
38 pkg-config
39 ];
40
41 buildInputs = [
42 bzip2
43 cfitsio
44 exiv2
45 gtk2
46 gtkimageview
47 lcms2
48 lensfun
49 libjpeg
50 libtiff
51 zlib
52 ];
53
54 configureFlags = [
55 "--enable-contrast"
56 "--enable-dst-correction"
57 ];
58
59 env.NIX_CFLAGS_COMPILE = "-Wno-narrowing";
60
61 postInstall = lib.optionalString addThumbnailer ''
62 mkdir -p $out/share/thumbnailers
63 substituteAll ${./nufraw.thumbnailer} $out/share/thumbnailers/${pname}.thumbnailer
64 '';
65
66 patches = [
67 # Fixes an upstream issue where headers with templates were included in an extern-C scope
68 # which caused the build to fail
69 (fetchpatch {
70 name = "0001-nufraw-glib-2.70.patch";
71 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/gimp-nufraw/-/raw/3405bc864752dbd04f2d182a21b4108d6cc3aa95/0001-nufraw-glib-2.70.patch";
72 hash = "sha256-XgzgjikWTcqymHa7bKmruNZaeb2/lpN19HXoRUt5rTk=";
73 })
74 ]
75 ++ lib.optionals (lib.versionAtLeast exiv2.version "0.28") [
76 (fetchpatch {
77 name = "0002-exiv2-error.patch";
78 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/gimp-nufraw/-/raw/3405bc864752dbd04f2d182a21b4108d6cc3aa95/0002-exiv2-error.patch";
79 hash = "sha256-40/Wwk1sWiaIWp077EYgP8jFO4k1cvf30heRDMYJw3M=";
80 })
81 ];
82
83 meta = with lib; {
84 homepage = "https://nufraw.sourceforge.io/";
85 description = "Utility to read and manipulate raw images from digital cameras";
86 longDescription = ''
87 A new version of the popular raw digital images manipulator ufraw.
88 Forks from the version 0.23 of ufraw (that's why the first nufraw version is the 0.24).
89 Nufraw offers the same features (gimp plugin, batch, ecc) and the same quality of
90 ufraw in a brand new improved user interface.
91 '';
92 license = licenses.gpl2Plus;
93 maintainers = with maintainers; [ asbachb ];
94 platforms = platforms.linux;
95 };
96}