Using eclipse-installer (aka OOMPH) under NixOS

Since a while the Eclipse project promotes the Eclipse Installer (aka OOMPH) Eclipse Installer - Eclipsepedia and many projects deliver .setup files which easen the task to get a complete eclipse development IDE.

Working for Elexis (see https://elexis.info) an Eclipse RCP program for all aspects of a medical practice, I struggled to port my IDE from Debian to NixOS.

Creating an empty director, placing the following script shell.nix there

#!/usr/bin/env nix-shell
with import <nixpkgs> {};
let mvn = pkgs.maven.override { jdk = pkgs.openjdk17; };
in mkShell {
    NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
      zlib
      dbus
      git
      glib
      glib-networking
      gnulib
      gsettings-desktop-schemas
      gtk3
      nss_latest nspr libdrm xorg.libXdamage mesa alsa-lib
      swt
      gvfs
      openjdk17
      librsvg
      libsecret
      libzip
      openssl
      stdenv
      stdenv.cc.cc
      unzip
      webkitgtk
      xorg.libXtst
    ];
    NIX_LD = builtins.readFile "${stdenv.cc}/nix-support/dynamic-linker";
    shellHook = ''
      export version=`echo ${gtk3}  | cut -d '-' -f 3`
      export GIO_MODULE_DIR=${glib-networking}/lib/gio/modules/
      echo GIO_MODULE_DIR are $GIO_MODULE_DIR
      export XDG_DATA_DIRS="$XDG_DATA_DIRS:${gtk3}/share/gsettings-schemas/gtk+3-$version:${at-spi2-core}/share/dbus-1/services"
      export GDK_BACKEND=x11
      export GSETTINGS_SCHEMA_DIR=${at-spi2-core}/share/dbus-1/services
      echo GSETTINGS_SCHEMA_DIR are $GSETTINGS_SCHEMA_DIR
      echo version is $version with GDK_BACKEND $GDK_BACKEND
      # eclipse/eclipse
    '';
  }

Allows me to call nix-shell, download the Eclipse Installer from Eclipse Downloads | The Eclipse Foundation.
Following the instructions under elexis-3-core/ch.elexis.sdk at master · elexis/elexis-3-core · GitHub was painless.

Here some notes about the script.

  • As I am running KDE with wayland, I needed gtk3 and setting GDK_BACKEND=x11 to allow copy/paste to my wayland apps
  • Opening the internal webbrowser needed webkitgtk, nss_latest nspr libdrm xorg.libXdamage mesa alsa-lib
  • The at-spi2-core avoids errors about not finding spi2
    Some errors I found only when really working with my IDE, as some libraries are only neede in certain situation.
    Theres i no guarantee, that it will work for your project, but I hope it will help you get started.
Hosted by Flying Circus.