Skip to content

Commit d85298f

Browse files
committed
lib/options: add noNullDefault (#18)
Resolves #18
1 parent ab2a1f7 commit d85298f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/options.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ in rec {
6969
allowStr = addTypeToOption str;
7070

7171
noDefault = option: builtins.removeAttrs option ["default"];
72+
# This is a more convenient way to handle the presence of a default value in the option based on the condition (#18)
73+
noNullDefault = option:
74+
if option.default == null
75+
then builtins.removeAttrs option ["default"]
76+
else option;
7277
readOnly = option: option // {readOnly = true;};
7378

7479
apply = option: apply: option // {inherit apply;};

0 commit comments

Comments
 (0)