Files
nixpkgs/pkgs/applications/editors/eclipse/build-eclipse.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

128 lines
2.9 KiB
Nix

{
lib,
stdenv,
makeDesktopItem,
freetype,
fontconfig,
libX11,
libXrender,
zlib,
jdk,
glib,
glib-networking,
gtk,
libXtst,
libsecret,
gsettings-desktop-schemas,
webkitgtk_4_1,
makeWrapper,
perl,
...
}:
{
pname,
src ? builtins.getAttr stdenv.hostPlatform.system sources,
sources ? null,
description,
version,
}:
stdenv.mkDerivation rec {
inherit pname version src;
desktopItem = makeDesktopItem {
name = "Eclipse";
exec = "eclipse";
icon = "eclipse";
comment = "Integrated Development Environment";
desktopName = "Eclipse IDE";
genericName = "Integrated Development Environment";
categories = [ "Development" ];
};
nativeBuildInputs = [
makeWrapper
perl
];
buildInputs = [
fontconfig
freetype
glib
gsettings-desktop-schemas
gtk
jdk
libX11
libXrender
libXtst
libsecret
zlib
]
++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1;
buildCommand = ''
# Unpack tarball.
mkdir -p $out
tar xfvz $src -C $out
# Patch binaries.
interpreter="$(cat $NIX_BINTOOLS/nix-support/dynamic-linker)"
libCairo=$out/eclipse/libcairo-swt.so
patchelf --set-interpreter $interpreter $out/eclipse/eclipse
[ -f $libCairo ] && patchelf --set-rpath ${
lib.makeLibraryPath [
freetype
fontconfig
libX11
libXrender
zlib
]
} $libCairo
# Create wrapper script. Pass -configuration to store
# settings in ~/.eclipse/org.eclipse.platform_<version> rather
# than ~/.eclipse/org.eclipse.platform_<version>_<number>.
productId=$(sed 's/id=//; t; d' $out/eclipse/.eclipseproduct)
makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath (
[
glib
gtk
libXtst
libsecret
]
++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1
)
} \
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--add-flags "-configuration \$HOME/.eclipse/''${productId}_${version}/configuration"
# Create desktop item.
mkdir -p $out/share/applications
cp ${desktopItem}/share/applications/* $out/share/applications
mkdir -p $out/share/pixmaps
ln -s $out/eclipse/icon.xpm $out/share/pixmaps/eclipse.xpm
# ensure eclipse.ini does not try to use a justj jvm, as those aren't compatible with nix
perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini
''; # */
passthru.updateScript = ./update.sh;
meta = {
homepage = "https://www.eclipse.org/";
inherit description;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
maintainers = [ lib.maintainers.jerith666 ];
};
}