From d8bbae877a6049867625ac86134422f8765b2157 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Thu, 5 Nov 2009 15:39:45 +0000 Subject: [PATCH] * Add a type for read-only options. Options which are only declared are used when a module produces read-only data for other modules. svn path=/nixpkgs/trunk/; revision=18148 --- pkgs/lib/types.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/lib/types.nix b/pkgs/lib/types.nix index 8b0f61549b5d..01a5d98fca62 100644 --- a/pkgs/lib/types.nix +++ b/pkgs/lib/types.nix @@ -110,6 +110,12 @@ rec { throw "Multiple definitions. Only one is allowed for this option."; }; + none = elemType: mkOptionType { + inherit (elemType) name check iter fold docPath hasOptions; + merge = list: + throw "No definitions are allowed for this option."; + }; + nullOr = elemType: mkOptionType { inherit (elemType) name merge docPath hasOptions; check = x: builtins.isNull x || elemType.check x;