openjdk: Ugly hack to fix nix-env installation

Nix-env always wants to install all outputs of a derivation, but this
failed for openjdk/openjre because openjdk has some symlinks (such as
bin/java) to openjre.  Also, it prevents installing the openjre
without the openjdk.  So as a workaround, mess with the "outputs"
attribute to fool nix-env.

Also, give openjre a separate name and description.

Fixes #1535.
This commit is contained in:
Eelco Dolstra 2014-01-20 14:54:50 +01:00
parent 9068ba2bb4
commit 8890492872
2 changed files with 9 additions and 6 deletions

View file

@ -14,7 +14,7 @@ rec {
addMetaAttrs {description = "Bla blah";} somePkg
*/
addMetaAttrs = newAttrs: drv:
drv // { meta = (if drv ? meta then drv.meta else {}) // newAttrs; };
drv // { meta = (drv.meta or {}) // newAttrs; };
/* Change the symbolic name of a package for presentation purposes
@ -51,7 +51,7 @@ rec {
/* Apply lowPrio to an attrset with derivations
*/
lowPrioSet = set: mapDerivationAttrset lowPrio set;
lowPrioSet = set: mapDerivationAttrset lowPrio set;
/* Increase the nix-env priority of the package, i.e., this
@ -63,5 +63,5 @@ rec {
/* Apply hiPrio to an attrset with derivations
*/
hiPrioSet = set: mapDerivationAttrset hiPrio set;
}

View file

@ -2851,11 +2851,14 @@ let
else
let
openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix { };
in callPackage ../development/compilers/openjdk {
in (callPackage ../development/compilers/openjdk {
jdk = openjdkBootstrap;
};
}) // { outputs = [ "out" ]; };
openjre = pkgs.openjdk.jre;
# FIXME: Need a way to set per-output meta attributes.
openjre = (lib.setName "openjre-${lib.getVersion pkgs.openjdk.jre}" (lib.addMetaAttrs
{ description = "The open-source Java Runtime Environment"; }
pkgs.openjdk.jre)) // { outputs = [ "jre" ]; };
jdk = if stdenv.isDarwin || stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
then pkgs.openjdk