1{ config, lib, ... }:
2
3{
4 options = {
5 result = lib.mkOption { };
6 weird = lib.mkOption {
7 type = lib.types.submoduleWith {
8 # I generally recommend against overriding lib, because that leads to
9 # slightly incompatible dialects of the module system.
10 # Nonetheless, it's worth guarding the property that the module system
11 # evaluates with a completely custom lib, as a matter of separation of
12 # concerns.
13 specialArgs.lib = { };
14 modules = [ ];
15 };
16 };
17 };
18 config.weird =
19 args@{
20 ... # note the lack of a `lib` argument
21 }:
22 assert args.lib == { };
23 assert args.specialArgs == { lib = { }; };
24 {
25 options.foo = lib.mkOption { };
26 config.foo = lib.mkIf true "alright";
27 };
28 config.result =
29 assert config.weird.foo == "alright";
30 "ok";
31}