* Move the `optional' function to lib.

svn path=/nixpkgs/trunk/; revision=8720
This commit is contained in:
Eelco Dolstra 2007-05-20 20:24:43 +00:00
parent 978a82c5f4
commit 14c0ae4055
2 changed files with 10 additions and 6 deletions

@ -107,5 +107,11 @@ rec {
);
in src: builtins.filterSource filter src;
# Return a singleton list or an empty list, depending on a boolean
# value. Useful when building lists with optional elements
# (e.g. `++ optional (system == "i686-linux") flashplayer').
optional = cond: elem: if cond then [elem] else [];
}

@ -166,8 +166,6 @@ rec {
meta = (if drv ? meta then drv.meta else {}) // {priority = "10";};
};
optional = cond: elem: if cond then [elem] else [];
### STANDARD ENVIRONMENT
@ -2968,10 +2966,10 @@ rec {
plugins = [
MPlayerPlugin
]
++ optional (system == "i686-linux") flashplayer
++ lib.optional (system == "i686-linux") flashplayer
# RealPlayer is disabled by default for legal reasons.
++ optional (system != "i686-linux" && getConfig ["firefox" "enableRealPlayer"] false) RealPlayer
++ optional (supportsJDK && jrePlugin ? mozillaPlugin) jrePlugin;
++ lib.optional (system != "i686-linux" && getConfig ["firefox" "enableRealPlayer"] false) RealPlayer
++ lib.optional (supportsJDK && jrePlugin ? mozillaPlugin) jrePlugin;
};
xara = import ../applications/graphics/xara {