at master 1.3 kB view raw
1{ 2 lib, 3 config, 4 options, 5 ... 6}: 7let 8 inherit (lib) types; 9in 10{ 11 imports = [ 12 13 # fun.<function-body>.a 14 ( 15 { ... }: 16 { 17 options = { 18 fun = lib.mkOption { 19 type = types.functionTo ( 20 types.submodule { 21 options.a = lib.mkOption { default = "a"; }; 22 } 23 ); 24 }; 25 }; 26 } 27 ) 28 29 # fun.<function-body>.b 30 ( 31 { ... }: 32 { 33 options = { 34 fun = lib.mkOption { 35 type = types.functionTo ( 36 types.submodule { 37 options.b = lib.mkOption { default = "b"; }; 38 } 39 ); 40 }; 41 }; 42 } 43 ) 44 ]; 45 46 options = { 47 result = lib.mkOption { 48 type = types.str; 49 default = lib.concatStringsSep " " ( 50 lib.attrValues (config.fun (throw "shouldn't use input param")) 51 ); 52 }; 53 54 optionsResult = lib.mkOption { 55 type = types.str; 56 default = lib.concatStringsSep " " ( 57 lib.concatLists ( 58 lib.mapAttrsToList (k: v: if k == "_module" then [ ] else [ (lib.showOption v.loc) ]) ( 59 (options.fun.type.getSubOptions [ "fun" ]) 60 ) 61 ) 62 ); 63 }; 64 }; 65 66 config.fun = lib.mkMerge [ 67 (input: { b = "bee"; }) 68 ]; 69}