1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
{
lib,
stdenv,
makeDesktopItem,
freetype,
fontconfig,
libx11,
libxrender,
zlib,
jdk,
glib,
glib-networking,
gtk,
libxtst,
libsecret,
gsettings-desktop-schemas,
webkitgtk_4_1,
makeWrapper,
perl,
...
}:
{
pname,
src ? builtins.getAttr stdenv.hostPlatform.system sources,
sources ? null,
description,
version,
}:
stdenv.mkDerivation (finalAttrs: {
inherit pname version src;
desktopItem = makeDesktopItem {
name = "Eclipse";
exec = "eclipse";
icon = "eclipse";
comment = "Integrated Development Environment";
desktopName = "Eclipse IDE";
genericName = "Integrated Development Environment";
categories = [ "Development" ];
};
nativeBuildInputs = [
makeWrapper
perl
];
buildInputs = [
fontconfig
freetype
glib
gsettings-desktop-schemas
gtk
jdk
libx11
libxrender
libxtst
libsecret
zlib
]
++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1;
buildCommand = ''
# Unpack tarball.
mkdir -p $out
tar xfvz $src -C $out
# Patch binaries.
interpreter="$(cat $NIX_BINTOOLS/nix-support/dynamic-linker)"
libCairo=$out/eclipse/libcairo-swt.so
patchelf --set-interpreter $interpreter $out/eclipse/eclipse
[ -f $libCairo ] && patchelf --set-rpath ${
lib.makeLibraryPath [
freetype
fontconfig
libx11
libxrender
zlib
]
} $libCairo
# Create wrapper script. Pass -configuration to store
# settings in ~/.eclipse/org.eclipse.platform_<version> rather
# than ~/.eclipse/org.eclipse.platform_<version>_<number>.
productId=$(sed 's/id=//; t; d' $out/eclipse/.eclipseproduct)
makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath (
[
glib
gtk
libxtst
libsecret
]
++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1
)
} \
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--add-flags "-configuration \$HOME/.eclipse/''${productId}_${version}/configuration"
# Create desktop item.
mkdir -p $out/share/applications
cp ${finalAttrs.desktopItem}/share/applications/* $out/share/applications
mkdir -p $out/share/pixmaps
ln -s $out/eclipse/icon.xpm $out/share/pixmaps/eclipse.xpm
# ensure eclipse.ini does not try to use a justj jvm, as those aren't compatible with nix
perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini
''; # */
passthru.updateScript = ./update.sh;
meta = {
homepage = "https://www.eclipse.org/";
inherit description;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
maintainers = [ lib.maintainers.jerith666 ];
};
})
|