1{
2 lib,
3 stdenv,
4 makeDesktopItem,
5 fetchFromGitHub,
6 pkg-config,
7 copyDesktopItems,
8 cairo,
9 freetype,
10 ghostscript,
11 gsl,
12 libjpeg,
13 libpng,
14 libspiro,
15 lua5,
16 qtbase,
17 qtsvg,
18 texliveSmall,
19 qhull,
20 wrapQtAppsHook,
21 zlib,
22 withTeXLive ? true,
23 withQVoronoi ? false,
24 buildPackages,
25}:
26
27stdenv.mkDerivation rec {
28 pname = "ipe";
29 version = "7.2.30";
30
31 src = fetchFromGitHub {
32 owner = "otfried";
33 repo = "ipe";
34 tag = "v${version}";
35 hash = "sha256-bvwEgEP/cinigixJr8e964sm6secSK+7Ul7WFfwM0gE=";
36 };
37
38 nativeBuildInputs = [
39 pkg-config
40 copyDesktopItems
41 wrapQtAppsHook
42 ];
43
44 buildInputs = [
45 cairo
46 freetype
47 ghostscript
48 gsl
49 libjpeg
50 libpng
51 libspiro
52 lua5
53 qtbase
54 qtsvg
55 zlib
56 ]
57 ++ (lib.optionals withTeXLive [
58 texliveSmall
59 ])
60 ++ (lib.optionals withQVoronoi [
61 qhull
62 ]);
63
64 makeFlags = [
65 "-C src"
66 "IPEPREFIX=${placeholder "out"}"
67 "LUA_PACKAGE=lua"
68 "MOC=${buildPackages.qt6Packages.qtbase}/libexec/moc"
69 "IPE_NO_SPELLCHECK=1" # qtSpell is not yet packaged
70 ]
71 ++ (lib.optionals withQVoronoi [
72 "IPEQVORONOI=1"
73 "QHULL_CFLAGS=-I${qhull}/include/libqhull_r"
74 ]);
75
76 qtWrapperArgs = lib.optionals withTeXLive [ "--prefix PATH : ${lib.makeBinPath [ texliveSmall ]}" ];
77
78 enableParallelBuilding = true;
79
80 desktopItems = [
81 (makeDesktopItem {
82 name = pname;
83 desktopName = "Ipe";
84 genericName = "Drawing editor";
85 comment = "A drawing editor for creating figures in PDF format";
86 exec = "ipe";
87 icon = "ipe";
88 mimeTypes = [
89 "text/xml"
90 "application/pdf"
91 ];
92 categories = [
93 "Graphics"
94 "Qt"
95 ];
96 startupNotify = true;
97 startupWMClass = "ipe";
98 })
99 ];
100
101 postInstall = ''
102 mkdir -p $out/share/icons/hicolor/128x128/apps
103 ln -s $out/share/ipe/${version}/icons/icon_128x128.png $out/share/icons/hicolor/128x128/apps/ipe.png
104 '';
105
106 meta = with lib; {
107 description = "Editor for drawing figures";
108 homepage = "http://ipe.otfried.org"; # https not available
109 license = licenses.gpl3Plus;
110 longDescription = ''
111 Ipe is an extensible drawing editor for creating figures in PDF and Postscript format.
112 It supports making small figures for inclusion into LaTeX-documents
113 as well as presentations in PDF.
114 '';
115 maintainers = with maintainers; [ ttuegel ];
116 platforms = platforms.linux;
117 };
118}