summary refs log tree commit diff
path: root/pkgs/build-support/checker/default.nix
blob: ae25493c77c521707a7f08448a1ed48083474670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
#  Checks that all set options are described.
#
options: configuration:
with builtins;
let lib=(import ../../lib); in
with lib;

let 
  findInList = p: list: default:
       if (list == []) then default else
       if (p (head list)) then (head list) else
       findInList p (tail list) default;
  

  checkAttrInclusion = s: a: b:
	(
	if (! isAttrs b) then s else
	if (lib.getAttr ["_type"] "" b) == "option" then "" else
	findInList (x : x != "") 
		( map (x: if (x == "servicesProposal") # this attr will be checked at another place ( -> upstart-jobs/default.nix )
                       then ""
                       else checkAttrInclusion 
			(s + "." + x) 
			(__getAttr x a)
			(lib.getAttr [x] null b)) 
		(attrNames a)) ""
	);
in 	
	checkAttrInclusion "" configuration options