mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-16 18:37:04 +03:00
8890492872
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.
68 lines
1.7 KiB
Nix
68 lines
1.7 KiB
Nix
/* Some functions for manipulating meta attributes, as well as the
|
|
name attribute. */
|
|
|
|
let lib = import ./default.nix;
|
|
in
|
|
|
|
rec {
|
|
|
|
|
|
/* Add to or override the meta attributes of the given
|
|
derivation.
|
|
|
|
Example:
|
|
addMetaAttrs {description = "Bla blah";} somePkg
|
|
*/
|
|
addMetaAttrs = newAttrs: drv:
|
|
drv // { meta = (drv.meta or {}) // newAttrs; };
|
|
|
|
|
|
/* Change the symbolic name of a package for presentation purposes
|
|
(i.e., so that nix-env users can tell them apart).
|
|
*/
|
|
setName = name: drv: drv // {inherit name;};
|
|
|
|
|
|
/* Like `setName', but takes the previous name as an argument.
|
|
|
|
Example:
|
|
updateName (oldName: oldName + "-experimental") somePkg
|
|
*/
|
|
updateName = updater: drv: drv // {name = updater (drv.name);};
|
|
|
|
|
|
/* Append a suffix to the name of a package. !!! the suffix should
|
|
really be appended *before* the version, at least most of the
|
|
time.
|
|
*/
|
|
appendToName = suffix: updateName (name: "${name}-${suffix}");
|
|
|
|
|
|
/* Apply a function to each derivation and only to derivations in an attrset
|
|
*/
|
|
mapDerivationAttrset = f: set: lib.mapAttrs (name: pkg: if lib.isDerivation pkg then (f pkg) else pkg) set;
|
|
|
|
|
|
/* Decrease the nix-env priority of the package, i.e., other
|
|
versions/variants of the package will be preferred.
|
|
*/
|
|
lowPrio = drv: addMetaAttrs { priority = "10"; } drv;
|
|
|
|
|
|
/* Apply lowPrio to an attrset with derivations
|
|
*/
|
|
lowPrioSet = set: mapDerivationAttrset lowPrio set;
|
|
|
|
|
|
/* Increase the nix-env priority of the package, i.e., this
|
|
version/variant of the package will be preferred.
|
|
*/
|
|
hiPrio = drv: addMetaAttrs { priority = "-10"; } drv;
|
|
|
|
|
|
/* Apply hiPrio to an attrset with derivations
|
|
*/
|
|
hiPrioSet = set: mapDerivationAttrset hiPrio set;
|
|
|
|
}
|