From c24e01665b72a537c6ff3623439a676e4c6d0ca9 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 29 Jul 2015 23:29:38 +0200 Subject: [PATCH] eclipses.plugins: add `buildEclipsePluginBase` This function provides functionality common to all Eclipse plugin builders. In particular, it sets a package name and flags the derivation as an Eclipse plugin. --- pkgs/applications/editors/eclipse/default.nix | 4 ++- pkgs/applications/editors/eclipse/plugins.nix | 31 +++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix index 5f3d4eb18f7..b3b9d273257 100644 --- a/pkgs/applications/editors/eclipse/default.nix +++ b/pkgs/applications/editors/eclipse/default.nix @@ -358,7 +358,9 @@ in { # Gather up the desired plugins. pluginEnv = buildEnv { name = "eclipse-plugins"; - paths = plugins; + paths = + with stdenv.lib; + filter (x: x ? isEclipsePlugin) (closePropagation plugins); }; # Prepare the JVM arguments to add to the ini file. We here also diff --git a/pkgs/applications/editors/eclipse/plugins.nix b/pkgs/applications/editors/eclipse/plugins.nix index cba556074a1..88ebaa4c4a5 100644 --- a/pkgs/applications/editors/eclipse/plugins.nix +++ b/pkgs/applications/editors/eclipse/plugins.nix @@ -2,20 +2,33 @@ let + buildEclipsePluginBase = { name + , buildInputs ? [] + , passthru ? {} + , ... } @ attrs: + stdenv.mkDerivation (attrs // { + name = "eclipse-" + name; + + buildInputs = buildInputs ++ [ unzip ]; + + passthru = { + isEclipsePlugin = true; + } // passthru; + }); + # Helper for the common case where we have separate feature and # plugin JARs. - buildEclipsePlugin = { name, version, javaName, srcFeature, srcPlugin, meta }: - stdenv.mkDerivation { - name = "eclipse-" + name; - inherit meta; + buildEclipsePlugin = { name, version, javaName, srcFeature, srcPlugin, meta, propagatedBuildInputs ? [] }: + buildEclipsePluginBase { + inherit name meta propagatedBuildInputs; srcs = [ srcFeature srcPlugin ]; - buildInputs = [ unzip ]; phases = [ "installPhase" ]; installPhase = '' dropinDir="$out/eclipse/dropins/${name}" + mkdir -p $dropinDir/features/${javaName}_${version} unzip ${srcFeature} -d $dropinDir/features/${javaName}_${version} @@ -27,12 +40,10 @@ let # Helper for the case where we have a ZIP file containing an Eclipse # update site. - buildEclipseUpdateSite = { name, version, src, meta }: - stdenv.mkDerivation { - name = "eclipse-" + name; - inherit meta src; + buildEclipseUpdateSite = { name, version, src, meta, propagatedBuildInputs ? [] }: + buildEclipsePluginBase { + inherit name meta src propagatedBuildInputs; - buildInputs = [ unzip ]; phases = [ "unpackPhase" "installPhase" ]; installPhase = ''