summary refs log tree commit diff
path: root/pkgs/lib/types.nix
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/types.nix
parent5684506470f7fbf76c308fd58f92b9a4211aa175 (diff)
downloadnixpkgs-d8bbae877a6049867625ac86134422f8765b2157.tar
nixpkgs-d8bbae877a6049867625ac86134422f8765b2157.tar.gz
nixpkgs-d8bbae877a6049867625ac86134422f8765b2157.tar.bz2
nixpkgs-d8bbae877a6049867625ac86134422f8765b2157.tar.lz
nixpkgs-d8bbae877a6049867625ac86134422f8765b2157.tar.xz
nixpkgs-d8bbae877a6049867625ac86134422f8765b2157.tar.zst
nixpkgs-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/types.nix')
-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 8b0f61549b5..01a5d98fca6 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;