3
0
Fork 0
forked from mirrors/nixpkgs

* 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

View file

@ -107,5 +107,11 @@ rec {
); );
in src: builtins.filterSource filter src; 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 [];
} }

View file

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