Added possibility for flags= in calls to proposed template. As usual, look at huge Vim.

svn path=/nixpkgs/trunk/; revision=9135
This commit is contained in:
Michael Raskin 2007-08-15 20:54:11 +00:00
parent bf087c5cd4
commit 75747d3b1c

View File

@ -128,6 +128,7 @@ rec {
checkFlag = attrSet: name:
if (name == "true") then true else
if (name == "false") then false else
if (isInList (getAttr ["flags"] [] attrSet) name) then true else
getAttr [name] false attrSet ;
logicalOR = x: y: x || y;
@ -136,7 +137,8 @@ rec {
# Input : attrSet, [ [name default] ... ], name
# Output : its value or default.
getValue = attrSet: argList: name:
( getAttr [name] (if argList == [] then null else
( getAttr [name] (if checkFlag attrSet name then true else
if argList == [] then null else
let x = builtins.head argList; in
if (head x) == name then
(head (tail x))