Skip to content

Commit

Permalink
openjdk: Ugly hack to fix nix-env installation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edolstra committed Jan 20, 2014
1 parent 9068ba2 commit 8890492
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/meta.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -63,5 +63,5 @@ rec {
/* Apply hiPrio to an attrset with derivations
*/
hiPrioSet = set: mapDerivationAttrset hiPrio set;

}
9 changes: 6 additions & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8890492

Please sign in to comment.