Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 127 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 makeDesktopItem, 5 freetype, 6 fontconfig, 7 libX11, 8 libXrender, 9 zlib, 10 jdk, 11 glib, 12 glib-networking, 13 gtk, 14 libXtst, 15 libsecret, 16 gsettings-desktop-schemas, 17 webkitgtk_4_1, 18 makeWrapper, 19 perl, 20 ... 21}: 22 23{ 24 pname, 25 src ? builtins.getAttr stdenv.hostPlatform.system sources, 26 sources ? null, 27 description, 28 version, 29}: 30 31stdenv.mkDerivation rec { 32 inherit pname version src; 33 34 desktopItem = makeDesktopItem { 35 name = "Eclipse"; 36 exec = "eclipse"; 37 icon = "eclipse"; 38 comment = "Integrated Development Environment"; 39 desktopName = "Eclipse IDE"; 40 genericName = "Integrated Development Environment"; 41 categories = [ "Development" ]; 42 }; 43 44 nativeBuildInputs = [ 45 makeWrapper 46 perl 47 ]; 48 buildInputs = [ 49 fontconfig 50 freetype 51 glib 52 gsettings-desktop-schemas 53 gtk 54 jdk 55 libX11 56 libXrender 57 libXtst 58 libsecret 59 zlib 60 ] 61 ++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1; 62 63 buildCommand = '' 64 # Unpack tarball. 65 mkdir -p $out 66 tar xfvz $src -C $out 67 68 # Patch binaries. 69 interpreter="$(cat $NIX_BINTOOLS/nix-support/dynamic-linker)" 70 libCairo=$out/eclipse/libcairo-swt.so 71 patchelf --set-interpreter $interpreter $out/eclipse/eclipse 72 [ -f $libCairo ] && patchelf --set-rpath ${ 73 lib.makeLibraryPath [ 74 freetype 75 fontconfig 76 libX11 77 libXrender 78 zlib 79 ] 80 } $libCairo 81 82 # Create wrapper script. Pass -configuration to store 83 # settings in ~/.eclipse/org.eclipse.platform_<version> rather 84 # than ~/.eclipse/org.eclipse.platform_<version>_<number>. 85 productId=$(sed 's/id=//; t; d' $out/eclipse/.eclipseproduct) 86 87 makeWrapper $out/eclipse/eclipse $out/bin/eclipse \ 88 --prefix PATH : ${jdk}/bin \ 89 --prefix LD_LIBRARY_PATH : ${ 90 lib.makeLibraryPath ( 91 [ 92 glib 93 gtk 94 libXtst 95 libsecret 96 ] 97 ++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1 98 ) 99 } \ 100 --prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \ 101 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \ 102 --add-flags "-configuration \$HOME/.eclipse/''${productId}_${version}/configuration" 103 104 # Create desktop item. 105 mkdir -p $out/share/applications 106 cp ${desktopItem}/share/applications/* $out/share/applications 107 mkdir -p $out/share/pixmaps 108 ln -s $out/eclipse/icon.xpm $out/share/pixmaps/eclipse.xpm 109 110 # ensure eclipse.ini does not try to use a justj jvm, as those aren't compatible with nix 111 perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini 112 ''; # */ 113 114 passthru.updateScript = ./update.sh; 115 116 meta = { 117 homepage = "https://www.eclipse.org/"; 118 inherit description; 119 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 120 platforms = [ 121 "x86_64-linux" 122 "aarch64-linux" 123 ]; 124 maintainers = [ lib.maintainers.jerith666 ]; 125 }; 126 127}