eclipseWithPlugins: lazier evaluation
Unfortunately the `readFile`/`writeText` functions forces realisation of the eclipse package at evaluation time. By creating the configuration file inside the build command we avoid realisation until installation.
This commit is contained in:
parent
bf605c16bf
commit
40890b2b95
|
@ -327,21 +327,20 @@ rec {
|
||||||
dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
|
dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
|
||||||
jvmArgsText = stdenv.lib.concatStringsSep "\n" (jvmArgs ++ [dropinProp]);
|
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
|
# Base the derivation name on the name of the underlying
|
||||||
# Eclipse.
|
# Eclipse.
|
||||||
name = (stdenv.lib.meta.appendToName "with-plugins" eclipse).name;
|
name = (stdenv.lib.meta.appendToName "with-plugins" eclipse).name;
|
||||||
in
|
in
|
||||||
runCommand name { buildInputs = [ makeWrapper ]; } ''
|
runCommand name { buildInputs = [ makeWrapper ]; } ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin $out/etc
|
||||||
|
|
||||||
|
# Prepare an eclipse.ini with the plugin directory.
|
||||||
|
cat ${eclipse}/eclipse/eclipse.ini - > $out/etc/eclipse.ini <<EOF
|
||||||
|
${jvmArgsText}
|
||||||
|
EOF
|
||||||
|
|
||||||
makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
|
makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
|
||||||
--add-flags "--launcher.ini ${eclipseIniFile}"
|
--add-flags "--launcher.ini $out/etc/eclipse.ini"
|
||||||
|
|
||||||
ln -s ${eclipse}/share $out/
|
ln -s ${eclipse}/share $out/
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue