biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / editors / eclipse / default.nix
blob732dc7695cc2b6fd908844e307d117533fc256cb
1 { lib, stdenv, fetchurl, makeDesktopItem, makeWrapper
2 , freetype, fontconfig, libX11, libXrender, zlib
3 , glib, gtk3, gtk2, libXtst, jdk, jdk8, gsettings-desktop-schemas
4 , webkitgtk ? null  # for internal web browser
5 , buildEnv, runCommand
6 , callPackage
7 }:
9 # use ./update.sh to help with updating for each quarterly release
11 # then, to test:
12 # 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
14 let
15   platform_major = "4";
16   platform_minor = "30";
17   year = "2023";
18   month = "12"; #release month
19   buildmonth = "12"; #sometimes differs from release month
20   timestamp = "${year}${buildmonth}010110";
21   gtk = gtk3;
22   arch = if stdenv.hostPlatform.isx86_64 then
23     "x86_64"
24   else if stdenv.hostPlatform.isAarch64 then
25     "aarch64"
26   else throw "don't know what platform suffix for ${stdenv.hostPlatform.system} will be";
27 in rec {
29   # work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=476075#c3
30   buildEclipseUnversioned = callPackage ./build-eclipse.nix {
31     inherit stdenv makeDesktopItem freetype fontconfig libX11 libXrender zlib
32             jdk glib gtk libXtst gsettings-desktop-schemas webkitgtk
33             makeWrapper;
34   };
35   buildEclipse = eclipseData: buildEclipseUnversioned (eclipseData // { productVersion = "${platform_major}.${platform_minor}"; });
37   ### Eclipse CPP
39   eclipse-cpp = buildEclipse {
40     name = "eclipse-cpp-${platform_major}.${platform_minor}";
41     description = "Eclipse IDE for C/C++ Developers";
42     src =
43       fetchurl {
44         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";
45         hash = {
46           x86_64 = "sha256-a5GqbghNlyvU/S36NcFSel1GRf/vZp01aaCxAswqyng=";
47           aarch64 = "sha256-w2bzolYBA4bf4kfcPza0LDLViKqXQkbZR07STN94nrY=";
48         }.${arch};
49       };
50   };
52   ### Eclipse DSL
54   eclipse-dsl = buildEclipse {
55     name = "eclipse-dsl-${platform_major}.${platform_minor}";
56     description = "Eclipse IDE for Java and DSL Developers";
57     src =
58       fetchurl {
59         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";
60         hash = {
61           x86_64 = "sha256-U9CMwcDZP1ptnc+C7gTfTOcyppe7r6RtgPp65b3A7Qk=";
62           aarch64 = "sha256-wuh6IZtRPDNJAVcfukFjZfuOVJgfj2zI616YNDnRgWM=";
63         }.${arch};
64       };
65   };
67   ### Eclipse IDE for Embedded C/C++ Developers
69   eclipse-embedcpp = buildEclipse {
70     name = "eclipse-embedcpp-${platform_major}.${platform_minor}";
71     description = "Eclipse IDE for Embedded C/C++ Developers";
72     src =
73       fetchurl {
74         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";
75         hash = {
76           x86_64 = "sha256-c/dd/3PzTSnrtaa2gNw+crdNu/xA428hYr8YNeBSEyw=";
77           aarch64 = "sha256-tF6o3NpFNxXALf2UA8tLzFhqYe46cI2swvym8vDSxNI=";
78         }.${arch};
79       };
80   };
82   ### Eclipse Modeling
84   eclipse-modeling = buildEclipse {
85     name = "eclipse-modeling-${platform_major}.${platform_minor}";
86     description = "Eclipse Modeling Tools";
87     src =
88       fetchurl {
89         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";
90         hash = {
91           x86_64 = "sha256-h1d0LTBKBKcYxeLr0QEK7VG3q8cKeHQPaKzoPU6qlkI=";
92           aarch64 = "sha256-nCkNNmL924I8Q6wjAmik7d3K4T4j0/Biyr4d9Y0KfSg=";
93         }.${arch};
94       };
95   };
97   ### Eclipse Platform
99   eclipse-platform = buildEclipse {
100     name = "eclipse-platform-${platform_major}.${platform_minor}";
101     description = "Eclipse Platform ${year}-${month}";
102     src =
103       fetchurl {
104         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";
105         hash = {
106           x86_64 = "sha256-FbcSbDFyjx2uG0T844cBwAdaBZc2k/c4aogsCVYI7+E=";
107           aarch64 = "sha256-COQipICwcM7+gbpiD/G31bsW+9NDz8wt+HyY6FFkKos=";
108         }.${arch};
109       };
110   };
112   ### Eclipse Scala SDK
114   eclipse-scala-sdk =
115     (buildEclipseUnversioned.override { jdk = jdk8; gtk = gtk2; } {
116       name = "eclipse-scala-sdk-4.7.0";
117       description = "Eclipse IDE for Scala Developers";
118       productVersion = "4.7";
119       src =
120         fetchurl {
121           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";
122           sha256  = "1n5w2a7mh9ajv6fxcas1gpgwb04pdxbr9v5dzr67gsz5bhahq4ya";
123         };
124   }).overrideAttrs(oa: {
125     # Only download for x86_64
126     meta.platforms = [ "x86_64-linux" ];
127   });
129   ### Eclipse SDK
131   eclipse-sdk = buildEclipse {
132     name = "eclipse-sdk-${platform_major}.${platform_minor}";
133     description = "Eclipse ${year}-${month} Classic";
134     src =
135       fetchurl {
136         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";
137         hash = {
138           x86_64 = "sha256-3UfaIwUpgD+VWB7Ar5by78zldqmrlg9csINkre+m8i0=";
139           aarch64 = "sha256-5wIlnTItwEstUHitlVPIxY7ayvxV4yI/8ID8WQ3mnDI=";
140         }.${arch};
141       };
142   };
144   ### Eclipse Java
146   eclipse-java = buildEclipse {
147     name = "eclipse-java-${platform_major}.${platform_minor}";
148     description = "Eclipse IDE for Java Developers";
149     src =
150       fetchurl {
151         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";
152         hash = {
153           x86_64 = "sha256-Cf2jrNjakRteGO/W18oneE9EDM3VLyi/lIafgffprUc=";
154           aarch64 = "sha256-j0i1k3fHQ/+P5y6aRKUZM8uBQJOLweDtkjneqlx/kuQ=";
155         }.${arch};
156       };
157   };
159   ### Eclipse Java EE
161   eclipse-jee = buildEclipse {
162     name = "eclipse-jee-${platform_major}.${platform_minor}";
163     description = "Eclipse IDE for Enterprise Java and Web Developers";
164     src =
165       fetchurl {
166         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";
167         hash = {
168           x86_64 = "sha256-pN+x63J8+GhGmfsdzLknJXWCnvhS8VeLizmyqWM8XUA=";
169           aarch64 = "sha256-QVW2nx5P6mkj4oJ1qHs5D2TZBuBuxayhiJHh0VgAghU=";
170         }.${arch};
171       };
172   };
174   ### Eclipse Committers
176   eclipse-committers = buildEclipse {
177     name = "eclipse-committers-${platform_major}.${platform_minor}";
178     description = "Eclipse IDE for Eclipse Committers and Eclipse Platform Plugin Developers";
179     src =
180       fetchurl {
181         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";
182         hash = {
183           x86_64 = "sha256-Qj9Omc3+HP3twF0evhkRKE8PH/i4+eGtnkfjUu9+lY4=";
184           aarch64 = "sha256-DqkwHyEbttFBA9HM3GdqxxZNjCiKf6gS7KNQYIUBAGE=";
185         }.${arch};
186       };
187   };
189   ### Eclipse IDE for RCP and RAP Developers
191   eclipse-rcp = buildEclipse {
192     name = "eclipse-rcp-${platform_major}.${platform_minor}";
193     description = "Eclipse IDE for RCP and RAP Developers";
194     src =
195       fetchurl {
196         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";
197         hash = {
198           x86_64 = "sha256-zhQU7hSF3KWJ0Q2TRzvGhL76Mxhhh/HS/wT/ahkFHXk=";
199           aarch64 = "sha256-XSqWx1V0XjtuYbZlRcJf7Xu1yL1VazT5Z/BcGkkXzb8=";
200         }.${arch};
201       };
202   };
204   ### Environments
206   # Function that assembles a complete Eclipse environment from an
207   # Eclipse package and list of Eclipse plugins.
208   eclipseWithPlugins = { eclipse, plugins ? [], jvmArgs ? [] }:
209     let
210       # Gather up the desired plugins.
211       pluginEnv = buildEnv {
212         name = "eclipse-plugins";
213         paths =
214           with lib;
215             filter (x: x ? isEclipsePlugin) (closePropagation plugins);
216       };
218       # Prepare the JVM arguments to add to the ini file. We here also
219       # add the property indicating the plugin directory.
220       dropinPropName = "org.eclipse.equinox.p2.reconciler.dropins.directory";
221       dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
222       jvmArgsText = lib.concatStringsSep "\n" (jvmArgs ++ [dropinProp]);
224       # Base the derivation name on the name of the underlying
225       # Eclipse.
226       name = (lib.meta.appendToName "with-plugins" eclipse).name;
227     in
228       runCommand name { nativeBuildInputs = [ makeWrapper ]; } ''
229         mkdir -p $out/bin $out/etc
231         # Prepare an eclipse.ini with the plugin directory.
232         cat ${eclipse}/eclipse/eclipse.ini - > $out/etc/eclipse.ini <<EOF
233         ${jvmArgsText}
234         EOF
236         makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
237           --add-flags "--launcher.ini $out/etc/eclipse.ini"
239         ln -s ${eclipse}/share $out/
240       '';
242   ### Plugins
244   plugins = callPackage ./plugins.nix { } // { __attrsFailEvaluation = true; };