1{
2 lib,
3 stdenv,
4 makeDesktopItem,
5 fetchFromGitHub,
6 pkg-config,
7 copyDesktopItems,
8 cairo,
9 freetype,
10 ghostscriptX,
11 gsl,
12 libjpeg,
13 libpng,
14 libspiro,
15 lua5,
16 qt6Packages,
17 texliveSmall,
18 qhull,
19 zlib,
20 withTeXLive ? true,
21 withQVoronoi ? false,
22 buildPackages,
23}:
24
25stdenv.mkDerivation (finalAttrs: {
26 pname = "ipe";
27 version = "7.2.30";
28
29 src = fetchFromGitHub {
30 owner = "otfried";
31 repo = "ipe";
32 tag = "v${finalAttrs.version}";
33 hash = "sha256-bvwEgEP/cinigixJr8e964sm6secSK+7Ul7WFfwM0gE=";
34 };
35
36 nativeBuildInputs = [
37 pkg-config
38 copyDesktopItems
39 qt6Packages.wrapQtAppsHook
40 ];
41
42 buildInputs = [
43 cairo
44 freetype
45 ghostscriptX
46 gsl
47 libjpeg
48 libpng
49 libspiro
50 lua5
51 ]
52 ++ (with qt6Packages; [
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 = "ipe";
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/${finalAttrs.version}/icons/icon_128x128.png $out/share/icons/hicolor/128x128/apps/ipe.png
104 '';
105
106 meta = {
107 description = "Editor for drawing figures";
108 homepage = "http://ipe.otfried.org"; # https not available
109 license = lib.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 lib.maintainers; [ ttuegel ];
116 platforms = lib.platforms.linux;
117 };
118})