ieda: init at 0-unstable-2024-10-11 (#338769)
[NixPkgs.git] / pkgs / applications / editors / eclipse / default.nix
blob74e8257c77bdaf796b784ebdefb7145f687bbc3f
2   lib,
3   stdenv,
4   fetchurl,
5   makeDesktopItem,
6   makeWrapper,
7   freetype,
8   fontconfig,
9   libX11,
10   libXrender,
11   zlib,
12   glib,
13   gtk3,
14   gtk2,
15   libXtst,
16   jdk,
17   jdk8,
18   gsettings-desktop-schemas,
19   webkitgtk_4_0 ? null, # for internal web browser
20   buildEnv,
21   runCommand,
22   callPackage,
25 # use ./update.sh to help with updating for each quarterly release
27 # then, to test:
28 # for e in cpp dsl embedcpp modeling platform sdk java jee committers rcp; 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
30 let
31   platform_major = "4";
32   platform_minor = "33";
33   year = "2024";
34   month = "09"; # release month
35   buildmonth = "09"; # sometimes differs from release month
36   timestamp = "${year}${buildmonth}030240";
37   gtk = gtk3;
38   arch =
39     if stdenv.hostPlatform.isx86_64 then
40       "x86_64"
41     else if stdenv.hostPlatform.isAarch64 then
42       "aarch64"
43     else
44       throw "don't know what platform suffix for ${stdenv.hostPlatform.system} will be";
46 rec {
48   # work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=476075#c3
49   buildEclipseUnversioned = callPackage ./build-eclipse.nix {
50     inherit
51       stdenv
52       makeDesktopItem
53       freetype
54       fontconfig
55       libX11
56       libXrender
57       zlib
58       jdk
59       glib
60       gtk
61       libXtst
62       gsettings-desktop-schemas
63       webkitgtk_4_0
64       makeWrapper
65       ;
66   };
67   buildEclipse =
68     eclipseData:
69     buildEclipseUnversioned (
70       eclipseData // { productVersion = "${platform_major}.${platform_minor}"; }
71     );
73   ### Eclipse CPP
75   eclipse-cpp = buildEclipse {
76     name = "eclipse-cpp-${platform_major}.${platform_minor}";
77     description = "Eclipse IDE for C/C++ Developers";
78     src = fetchurl {
79       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-cpp-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
80       hash =
81         {
82           x86_64 = "sha256-zCIVlrr8CPRBiv1FOVHjoW7WcKC74V+JC2ciyiBuYOw=";
83           aarch64 = "sha256-Lnwz8up/WoOdth0bxxePxagwkOaTljFYkCHHu5NoCPk=";
84         }
85         .${arch};
86     };
87   };
89   ### Eclipse DSL
91   eclipse-dsl = buildEclipse {
92     name = "eclipse-dsl-${platform_major}.${platform_minor}";
93     description = "Eclipse IDE for Java and DSL Developers";
94     src = fetchurl {
95       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-dsl-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
96       hash =
97         {
98           x86_64 = "sha256-a/Vnbm1zzay5GSsJbU3yFGs7fSBx77wvOHJdlEs8BjE=";
99           aarch64 = "sha256-ghf0Q31cudxGDmYvLXyeqTYCpqIkZNp9y1Bd/izOSl4=";
100         }
101         .${arch};
102     };
103   };
105   ### Eclipse IDE for Embedded C/C++ Developers
107   eclipse-embedcpp = buildEclipse {
108     name = "eclipse-embedcpp-${platform_major}.${platform_minor}";
109     description = "Eclipse IDE for Embedded C/C++ Developers";
110     src = fetchurl {
111       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-embedcpp-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
112       hash =
113         {
114           x86_64 = "sha256-6krmMvja30Jal1w4gi1NQSZpPxAMtjvs+tPtts+YuLA=";
115           aarch64 = "sha256-qYzcR+4m8QAdV6JTvMuVU2h2oxVJGmyg9UJMibdkPxM=";
116         }
117         .${arch};
118     };
119   };
121   ### Eclipse Modeling
123   eclipse-modeling = buildEclipse {
124     name = "eclipse-modeling-${platform_major}.${platform_minor}";
125     description = "Eclipse Modeling Tools";
126     src = fetchurl {
127       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-modeling-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
128       hash =
129         {
130           x86_64 = "sha256-AFwJNQJdULmiID3JPjQG3L631ujaNYsaDJ3QT60WwSY=";
131           aarch64 = "sha256-MbvWrgHhTS1odtFCdZYdTOYZNjhb3gqvjGO1dVfdokA=";
132         }
133         .${arch};
134     };
135   };
137   ### Eclipse Platform
139   eclipse-platform = buildEclipse {
140     name = "eclipse-platform-${platform_major}.${platform_minor}";
141     description = "Eclipse Platform ${year}-${month}";
142     src = fetchurl {
143       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-platform-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz";
144       hash =
145         {
146           x86_64 = "sha256-6vNwys0HTaJdSl+1mK7hlGU0tQVyakvzrL0GZEObniQ=";
147           aarch64 = "sha256-fERBf9bkGowZkRLQEMxLUB8qUVKZgRZOZjJEz+kc+WU=";
148         }
149         .${arch};
150     };
151   };
153   ### Eclipse Scala SDK
155   eclipse-scala-sdk =
156     (buildEclipseUnversioned.override
157       {
158         jdk = jdk8;
159         gtk = gtk2;
160       }
161       {
162         name = "eclipse-scala-sdk-4.7.0";
163         description = "Eclipse IDE for Scala Developers";
164         productVersion = "4.7";
165         src = fetchurl {
166           url = "https://downloads.typesafe.com/scalaide-pack/4.7.0-vfinal-oxygen-212-20170929/scala-SDK-4.7.0-vfinal-2.12-linux.gtk.x86_64.tar.gz";
167           sha256 = "1n5w2a7mh9ajv6fxcas1gpgwb04pdxbr9v5dzr67gsz5bhahq4ya";
168         };
169       }
170     ).overrideAttrs
171       (oa: {
172         # Only download for x86_64
173         meta.platforms = [ "x86_64-linux" ];
174       });
176   ### Eclipse SDK
178   eclipse-sdk = buildEclipse {
179     name = "eclipse-sdk-${platform_major}.${platform_minor}";
180     description = "Eclipse ${year}-${month} Classic";
181     src = fetchurl {
182       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-SDK-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz";
183       hash =
184         {
185           x86_64 = "sha256-4eYdixsPswwsBWfRng5VPp+/39mDuAO7cHc6NS3VI7o=";
186           aarch64 = "sha256-UUdm7YqLOTappGwEnM3frvGZcESuh3LVl1L/HoN88Ug=";
187         }
188         .${arch};
189     };
190   };
192   ### Eclipse Java
194   eclipse-java = buildEclipse {
195     name = "eclipse-java-${platform_major}.${platform_minor}";
196     description = "Eclipse IDE for Java Developers";
197     src = fetchurl {
198       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-java-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
199       hash =
200         {
201           x86_64 = "sha256-gAbc049iHCPwGohQwNG1pCejCpOh0qUsnjSZosedqUU=";
202           aarch64 = "sha256-VpKs4O1Rxb/qhULUK+EPIPsGSH+qQJpNsDRGNX09Bj0=";
203         }
204         .${arch};
205     };
206   };
208   ### Eclipse Java EE
210   eclipse-jee = buildEclipse {
211     name = "eclipse-jee-${platform_major}.${platform_minor}";
212     description = "Eclipse IDE for Enterprise Java and Web Developers";
213     src = fetchurl {
214       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-jee-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
215       hash =
216         {
217           x86_64 = "sha256-BLvjy4vBuvMt3mZccp+UWw9p58taWiyZkbwaeMOOBpU=";
218           aarch64 = "sha256-5tGJoOPk56/0WVZAxB8VWryJmnHMr4gHQyjET9sB1Qk=";
219         }
220         .${arch};
221     };
222   };
224   ### Eclipse Committers
226   eclipse-committers = buildEclipse {
227     name = "eclipse-committers-${platform_major}.${platform_minor}";
228     description = "Eclipse IDE for Eclipse Committers and Eclipse Platform Plugin Developers";
229     src = fetchurl {
230       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-committers-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
231       hash =
232         {
233           x86_64 = "sha256-IQL6dWNHg5DMVkR2XYge2jHmIwx8KS968k8EoS/II+A=";
234           aarch64 = "sha256-ATni52tdHyaVvacSAiiOB6eN1zwS17VZazcsd6HOemA=";
235         }
236         .${arch};
237     };
238   };
240   ### Eclipse IDE for RCP and RAP Developers
242   eclipse-rcp = buildEclipse {
243     name = "eclipse-rcp-${platform_major}.${platform_minor}";
244     description = "Eclipse IDE for RCP and RAP Developers";
245     src = fetchurl {
246       url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-rcp-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
247       hash =
248         {
249           x86_64 = "sha256-BqRcUU6GivuPFzr3e2FX+ga5OVO8o7NzuXuqUu52pN4=";
250           aarch64 = "sha256-lAsur73Z/EaKVLY9URoyvcvtD9LoOO7FG6l/lUtT8H8=";
251         }
252         .${arch};
253     };
254   };
256   ### Environments
258   # Function that assembles a complete Eclipse environment from an
259   # Eclipse package and list of Eclipse plugins.
260   eclipseWithPlugins =
261     {
262       eclipse,
263       plugins ? [ ],
264       jvmArgs ? [ ],
265     }:
266     let
267       # Gather up the desired plugins.
268       pluginEnv = buildEnv {
269         name = "eclipse-plugins";
270         paths = lib.filter (x: x ? isEclipsePlugin) (lib.closePropagation plugins);
271       };
273       # Prepare the JVM arguments to add to the ini file. We here also
274       # add the property indicating the plugin directory.
275       dropinPropName = "org.eclipse.equinox.p2.reconciler.dropins.directory";
276       dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
277       jvmArgsText = lib.concatStringsSep "\n" (jvmArgs ++ [ dropinProp ]);
279       # Base the derivation name on the name of the underlying
280       # Eclipse.
281       name = (lib.meta.appendToName "with-plugins" eclipse).name;
282     in
283     runCommand name { nativeBuildInputs = [ makeWrapper ]; } ''
284       mkdir -p $out/bin $out/etc
286       # Prepare an eclipse.ini with the plugin directory.
287       cat ${eclipse}/eclipse/eclipse.ini - > $out/etc/eclipse.ini <<EOF
288       ${jvmArgsText}
289       EOF
291       makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
292         --add-flags "--launcher.ini $out/etc/eclipse.ini"
294       ln -s ${eclipse}/share $out/
295     '';
297   ### Plugins
299   plugins = callPackage ./plugins.nix { };