Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, makeDesktopItem, freetype, fontconfig, libX11, libXrender 2, zlib, jdk, glib, glib-networking, gtk, libXtst, libsecret, gsettings-desktop-schemas, webkitgtk 3, makeWrapper, perl, ... }: 4 5{ name, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null, description, productVersion }: 6 7stdenv.mkDerivation rec { 8 inherit name src; 9 10 desktopItem = makeDesktopItem { 11 name = "Eclipse"; 12 exec = "eclipse"; 13 icon = "eclipse"; 14 comment = "Integrated Development Environment"; 15 desktopName = "Eclipse IDE"; 16 genericName = "Integrated Development Environment"; 17 categories = [ "Development" ]; 18 }; 19 20 nativeBuildInputs = [ makeWrapper perl ]; 21 buildInputs = [ 22 fontconfig freetype glib gsettings-desktop-schemas gtk jdk libX11 23 libXrender libXtst libsecret zlib 24 ] ++ lib.optional (webkitgtk != null) webkitgtk; 25 26 buildCommand = '' 27 # Unpack tarball. 28 mkdir -p $out 29 tar xfvz $src -C $out 30 31 # Patch binaries. 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 36 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) 41 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" 48 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 54 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 57 ''; # */ 58 59 meta = { 60 homepage = "https://www.eclipse.org/"; 61 inherit description; 62 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 63 platforms = [ "x86_64-linux" "aarch64-linux" ]; 64 }; 65 66}