forked from mirrors/nixpkgs
* Move some functions for manipulating meta and name attributes out of
all-packages.nix and into lib. svn path=/nixpkgs/trunk/; revision=14778
This commit is contained in:
parent
7505920605
commit
2405d87230
|
@ -6,12 +6,13 @@ let
|
||||||
attrsets = import ./attrsets.nix;
|
attrsets = import ./attrsets.nix;
|
||||||
sources = import ./sources.nix;
|
sources = import ./sources.nix;
|
||||||
options = import ./options.nix;
|
options = import ./options.nix;
|
||||||
|
meta = import ./meta.nix;
|
||||||
debug = import ./debug.nix;
|
debug = import ./debug.nix;
|
||||||
misc = import ./misc.nix;
|
misc = import ./misc.nix;
|
||||||
|
|
||||||
in
|
in
|
||||||
{ inherit trivial lists strings attrsets sources options debug; }
|
{ inherit trivial lists strings attrsets sources options meta debug; }
|
||||||
# !!! don't include everything at top-level; perhaps only the most
|
# !!! don't include everything at top-level; perhaps only the most
|
||||||
# commonly used functions.
|
# commonly used functions.
|
||||||
// trivial // lists // strings // attrsets // sources // options
|
// trivial // lists // strings // attrsets // sources // options
|
||||||
// debug // misc
|
// meta // debug // misc
|
||||||
|
|
44
pkgs/lib/meta.nix
Normal file
44
pkgs/lib/meta.nix
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/* Some functions for manipulating meta attributes, as well as the
|
||||||
|
name attribute. */
|
||||||
|
|
||||||
|
rec {
|
||||||
|
|
||||||
|
|
||||||
|
/* Add to or override the meta attributes of the given
|
||||||
|
derivation.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
addMetaAttrs {description = "Bla blah";} somePkg
|
||||||
|
*/
|
||||||
|
addMetaAttrs = newAttrs: drv:
|
||||||
|
drv // { meta = (if drv ? meta then drv.meta else {}) // 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}");
|
||||||
|
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -107,5 +107,18 @@ rec {
|
||||||
isStatic = true;
|
isStatic = true;
|
||||||
} // {inherit fetchurl;};
|
} // {inherit fetchurl;};
|
||||||
|
|
||||||
|
|
||||||
}
|
/* Modify a stdenv so that the specified attributes are added to
|
||||||
|
every derivation returned by its mkDerivation function.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
stdenvNoOptimise =
|
||||||
|
addAttrsToDerivation
|
||||||
|
{ NIX_CFLAGS_COMPILE = "-O0"; }
|
||||||
|
stdenv;
|
||||||
|
*/
|
||||||
|
addAttrsToDerivation = extraAttrs: stdenv: stdenv //
|
||||||
|
{ mkDerivation = args: stdenv.mkDerivation (args // extraAttrs); };
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue