From 75747d3b1ca3f0d065239464ba092db4a5145308 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Wed, 15 Aug 2007 20:54:11 +0000 Subject: [PATCH] Added possibility for flags= in calls to proposed template. As usual, look at huge Vim. svn path=/nixpkgs/trunk/; revision=9135 --- pkgs/lib/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 2359a1d3dd0..a30fe46623a 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -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))