about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2015-07-26 10:33:10 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2015-08-10 23:12:02 +0200
commit3310ebe993affad7c91eb912985c16be452ee86f (patch)
treef32d316a3f5a4e0abcd5b445d8c4fffa396dabb5 /pkgs/applications
parent9c20b9c779d94af1b18c0c86d7aff6a31ae142c5 (diff)
downloadnixlib-3310ebe993affad7c91eb912985c16be452ee86f.tar
nixlib-3310ebe993affad7c91eb912985c16be452ee86f.tar.gz
nixlib-3310ebe993affad7c91eb912985c16be452ee86f.tar.bz2
nixlib-3310ebe993affad7c91eb912985c16be452ee86f.tar.lz
nixlib-3310ebe993affad7c91eb912985c16be452ee86f.tar.xz
nixlib-3310ebe993affad7c91eb912985c16be452ee86f.tar.zst
nixlib-3310ebe993affad7c91eb912985c16be452ee86f.zip
eclipses: add function eclipseWithPlugins
This function allows installation of a given Eclipse with a given list
of Eclipse plugins.
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/editors/eclipse/default.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix
index 3ec498973219..f53cf891011b 100644
--- a/pkgs/applications/editors/eclipse/default.nix
+++ b/pkgs/applications/editors/eclipse/default.nix
@@ -2,6 +2,7 @@
 , freetype, fontconfig, libX11, libXext, libXrender, zlib
 , glib, gtk, libXtst, jre
 , webkitgtk2 ? null  # for internal web browser
+, buildEnv, writeText, runCommand
 }:
 
 assert stdenv ? glibc;
@@ -334,4 +335,38 @@ in {
         };
     };
   };
+
+  eclipseWithPlugins = { eclipse, plugins ? [], jvmArgs ? [] }:
+    let
+      # Gather up the desired plugins.
+      pluginEnv = buildEnv {
+        name = "eclipse-plugins";
+        paths = plugins;
+      };
+
+      # Prepare the JVM arguments to add to the ini file. We here also
+      # add the property indicating the plugin directory.
+      dropinPropName = "org.eclipse.equinox.p2.reconciler.dropins.directory";
+      dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
+      jvmArgsText = stdenv.lib.concatStringsSep "\n" (jvmArgs ++ [dropinProp]);
+
+      # Prepare an eclipse.ini with the plugin directory.
+      origEclipseIni = builtins.readFile "${eclipse}/eclipse/eclipse.ini";
+      eclipseIniFile = writeText "eclipse.ini" ''
+        ${origEclipseIni}
+        ${jvmArgsText}
+      '';
+
+      # Base the derivation name on the name of the underlying
+      # Eclipse.
+      name = (stdenv.lib.meta.appendToName "with-plugins" eclipse).name;
+    in
+      runCommand name { buildInputs = [ makeWrapper ]; } ''
+        mkdir -p $out/bin
+        makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
+          --add-flags "--launcher.ini ${eclipseIniFile}"
+
+        ln -s ${eclipse}/share $out/
+      '';
+
 }