about summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorDanylo Hlynskyi <abcz2.uprola@gmail.com>2019-03-07 21:28:09 +0200
committerGitHub <noreply@github.com>2019-03-07 21:28:09 +0200
commit60e8fcf0e56ce881294b06bd1f40069016308162 (patch)
tree15d4e83548173c9ae881e42e6557573864b68a3b /lib/types.nix
parentcf1de3c2df3d4ca558e81a62ba475ab8a4d9fce6 (diff)
downloadnixlib-60e8fcf0e56ce881294b06bd1f40069016308162.tar
nixlib-60e8fcf0e56ce881294b06bd1f40069016308162.tar.gz
nixlib-60e8fcf0e56ce881294b06bd1f40069016308162.tar.bz2
nixlib-60e8fcf0e56ce881294b06bd1f40069016308162.tar.lz
nixlib-60e8fcf0e56ce881294b06bd1f40069016308162.tar.xz
nixlib-60e8fcf0e56ce881294b06bd1f40069016308162.tar.zst
nixlib-60e8fcf0e56ce881294b06bd1f40069016308162.zip
module system: revert "remove types.optionSet", just deprecate (#56857)
The explicit remove helped to uncover some hidden uses of `optionSet`
in NixOps. However it makes life harder for end-users of NixOps - it will
be impossible to deploy 19.03 systems with old NixOps, but there is no
new release of NixOps with `optionSet` fixes.

Also, "deprecation" process isn't well defined. Even that `optionSet` was
declared "deprecated" for many years, it was never announced. Hence, I
leave "deprecation" announce. Then, 3 releases after announce,
we can announce removal of this feature.

This type has to be removed, not `throw`-ed in runtime, because it makes
some perfectly fine code to fail. For example:
```
$ nix-instantiate --eval -E '(import <nixpkgs/lib>).types' --strict
trace: `types.list` is deprecated; use `types.listOf` instead
error: types.optionSet is deprecated; use types.submodule instead
(use '--show-trace' to show detailed location information)
```
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/types.nix b/lib/types.nix
index 7a88e1b9e36b..b225119299da 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -469,8 +469,10 @@ rec {
     # Obsolete alternative to configOf.  It takes its option
     # declarations from the ‘options’ attribute of containing option
     # declaration.
-    optionSet = builtins.throw "types.optionSet is deprecated; use types.submodule instead" "optionSet";
-
+    optionSet = mkOptionType {
+      name = builtins.trace "types.optionSet is deprecated; use types.submodule instead" "optionSet";
+      description = "option set";
+    };
     # Augment the given type with an additional type check function.
     addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };