1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 05:31:22 +00:00
nixpkgs/pkgs/build-support/checker/default.nix
Michael Raskin dd5daab9d1 Options for kernel and checker for configuration.nix
svn path=/nixpkgs/trunk/; revision=9371
2007-09-25 19:03:07 +00:00

27 lines
678 B
Nix

#
# Checks that all set options are described.
#
options: configuration:
with builtins;
with (import ../../lib);
let
findInList = p: list: default:
if (list == []) then default else
if (p (head list)) then (head list) else
findInList p (tail list) default;
attrSetToList = attrs: if (isAttrs attrs) then (concatLists (map
(s:
(map (l: ([s] ++ l))
(attrSetToList (getAttr s attrs))))
(attrNames attrs))) else [[]];
in
let opts = (map (a: a.name) options);
conf = attrSetToList configuration;
in
let res=findInList (a: (findInList (b: (eqLists a b)) opts null)==null) conf null;
in
#if res==null then null else map (l: ["<"] ++ l ++ [">"]) res
res