1 { lib, stdenv, makeDesktopItem, freetype, fontconfig, libX11, libXrender
2 , zlib, jdk, glib, glib-networking, gtk, libXtst, libsecret, gsettings-desktop-schemas, webkitgtk
3 , makeWrapper, perl, ... }:
5 { name, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null, description, productVersion }:
7 stdenv.mkDerivation rec {
10 desktopItem = makeDesktopItem {
14 comment = "Integrated Development Environment";
15 desktopName = "Eclipse IDE";
16 genericName = "Integrated Development Environment";
17 categories = [ "Development" ];
20 nativeBuildInputs = [ makeWrapper perl ];
22 fontconfig freetype glib gsettings-desktop-schemas gtk jdk libX11
23 libXrender libXtst libsecret zlib
24 ] ++ lib.optional (webkitgtk != null) webkitgtk;
32 interpreter="$(cat $NIX_BINTOOLS/nix-support/dynamic-linker)"
33 libCairo=$out/eclipse/libcairo-swt.so
34 patchelf --set-interpreter $interpreter $out/eclipse/eclipse
35 [ -f $libCairo ] && patchelf --set-rpath ${lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ]} $libCairo
37 # Create wrapper script. Pass -configuration to store
38 # settings in ~/.eclipse/org.eclipse.platform_<version> rather
39 # than ~/.eclipse/org.eclipse.platform_<version>_<number>.
40 productId=$(sed 's/id=//; t; d' $out/eclipse/.eclipseproduct)
42 makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
43 --prefix PATH : ${jdk}/bin \
44 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ glib gtk libXtst libsecret ] ++ lib.optional (webkitgtk != null) webkitgtk)} \
45 --prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
46 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
47 --add-flags "-configuration \$HOME/.eclipse/''${productId}_${productVersion}/configuration"
49 # Create desktop item.
50 mkdir -p $out/share/applications
51 cp ${desktopItem}/share/applications/* $out/share/applications
52 mkdir -p $out/share/pixmaps
53 ln -s $out/eclipse/icon.xpm $out/share/pixmaps/eclipse.xpm
55 # ensure eclipse.ini does not try to use a justj jvm, as those aren't compatible with nix
56 perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini
60 homepage = "https://www.eclipse.org/";
62 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
63 platforms = [ "x86_64-linux" "aarch64-linux" ];