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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
{
lib,
stdenv,
fetchurl,
makeDesktopItem,
makeWrapper,
freetype,
fontconfig,
libx11,
libxrender,
zlib,
glib,
gtk3,
libxtst,
jdk,
gsettings-desktop-schemas,
webkitgtk_4_1 ? null, # for internal web browser
buildEnv,
runCommand,
callPackage,
}:
# ./update.sh fully automates updating for each quarterly release. you can run
# it manually, or wait for https://nix-community.github.io/nixpkgs-update/ to do
# so.
#
# then, to test (on x86_64):
# for e in $(cat pkgs/applications/editors/eclipse/eclipses.json | jq '.eclipses | keys | .[] | ascii_downcase' -r); do for s in pkgs pkgsCross.aarch64-multiplatform; do echo; echo $s $e; nix-build -A ${s}.eclipses.eclipse-${e} -o eclipse-${s}-${e}; done; done
let
eclipses = lib.trivial.importJSON ./eclipses.json;
inherit (eclipses)
platform_major
platform_minor
year
# release month sometimes differs from build month
month
buildmonth
dayHourMinute
;
timestamp = "${year}${buildmonth}${dayHourMinute}";
gtk = gtk3;
arch =
if stdenv.hostPlatform.isx86_64 then
"x86_64"
else if stdenv.hostPlatform.isAarch64 then
"aarch64"
else
throw "don't know what platform suffix for ${stdenv.hostPlatform.system} will be";
# work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=476075#c3
buildEclipseUnversioned = callPackage ./build-eclipse.nix {
inherit
stdenv
makeDesktopItem
freetype
fontconfig
libx11
libxrender
zlib
jdk
glib
gtk
libxtst
gsettings-desktop-schemas
webkitgtk_4_1
makeWrapper
;
};
buildEclipse =
eclipseData:
buildEclipseUnversioned (eclipseData // { version = "${platform_major}.${platform_minor}"; });
generateEclipse =
id:
{
description,
hashes,
dropUrl,
}:
builtins.listToAttrs [
{
name = "eclipse-${lib.strings.toLower id}";
value = buildEclipse {
pname = "eclipse-${lib.strings.toLower id}";
inherit description;
src = fetchurl {
url =
if dropUrl then
"https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-${id}-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz"
else
"https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-${id}-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
hash = hashes.${arch};
};
};
}
];
generatedEclipses = lib.attrsets.concatMapAttrs generateEclipse eclipses.eclipses;
in
generatedEclipses
// {
# expose this function so users can build their own eclipses if needed
inherit buildEclipse;
### Environments
# Function that assembles a complete Eclipse environment from an
# Eclipse package and list of Eclipse plugins.
eclipseWithPlugins =
{
eclipse,
plugins ? [ ],
jvmArgs ? [ ],
}:
let
# Gather up the desired plugins.
pluginEnv = buildEnv {
name = "eclipse-plugins";
paths = lib.filter (x: x ? isEclipsePlugin) (lib.closePropagation plugins);
};
# Prepare the JVM arguments to add to the ini file. We here also
# add the property indicating the plugin directory.
dropinPropName = "org.eclipse.equinox.p2.reconciler.dropins.directory";
dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
jvmArgsText = lib.concatStringsSep "\n" (jvmArgs ++ [ dropinProp ]);
# Base the derivation name on the name of the underlying
# Eclipse.
name = (lib.meta.appendToName "with-plugins" eclipse).name;
in
runCommand name { nativeBuildInputs = [ makeWrapper ]; } ''
mkdir -p $out/bin $out/etc
# Prepare an eclipse.ini with the plugin directory.
cat ${eclipse}/eclipse/eclipse.ini - > $out/etc/eclipse.ini <<EOF
${jvmArgsText}
EOF
makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
--add-flags "--launcher.ini $out/etc/eclipse.ini"
ln -s ${eclipse}/share $out/
'';
### Plugins
plugins = lib.recurseIntoAttrs (callPackage ./plugins.nix { });
}
|