summary refs log tree commit diff
path: root/pkgs/lib
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2009-11-05 15:39:45 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2009-11-05 15:39:45 +0000
commitd8bbae877a6049867625ac86134422f8765b2157 (patch)
treeffab2a80adcc89307ea52afea87aeb8c523549c3 /pkgs/lib
parent5684506470f7fbf76c308fd58f92b9a4211aa175 (diff)
downloadnixlib-d8bbae877a6049867625ac86134422f8765b2157.tar
nixlib-d8bbae877a6049867625ac86134422f8765b2157.tar.gz
nixlib-d8bbae877a6049867625ac86134422f8765b2157.tar.bz2
nixlib-d8bbae877a6049867625ac86134422f8765b2157.tar.lz
nixlib-d8bbae877a6049867625ac86134422f8765b2157.tar.xz
nixlib-d8bbae877a6049867625ac86134422f8765b2157.tar.zst
nixlib-d8bbae877a6049867625ac86134422f8765b2157.zip
* 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
Diffstat (limited to 'pkgs/lib')
-rw-r--r--pkgs/lib/types.nix6
1 files changed, 6 insertions, 0 deletions
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;