Writing home-manager module: re-export option with tomlFormat

I’m trying to write my first home-manager module and it’s been going somewhat well. Here’s the current state

{ pkgs, config, lib, ... }: 

with lib;

let
  cfg = config.programs.wallust;
  tomlFormat = pkgs.formats.toml { };

  templateModule = { ... }: {
    options = {
      source = mkOption {
        type = types.path;

        example = ''
          fetchurl {
            url = "https://raw.githubusercontent.com/dylanaraps/pywal/master/pywal/templates/colors.json";
            hash = "";
          };
        '';
        description = "The template source file";
      };

      destination = mkOption {
        type = types.path;

        example = "~/$XDG_CACHE_DIR/wal/colors.json";
        description = "The destination of the processed template";
      };
    };
  };

in {
  options.programs.wallust = {
    enable = mkOption {
      type = types.bool;
      default = false;

      example = true;
      description = "Whether to enable wallust.";
    };

    settings = mkOption {
      type = tomlFormat.type;
      default = {};

      example = ''
        {
          backend = "fastresize";
          color_space = "labfast";
        }
      '';
      description = ''
        Wallust configuration file.

        Written to {file}`$XDG_CONFIG_HOME/wallust/wallust.toml`
        An example configuration can be found at <https://codeberg.org/explosion-mental/wallust/src/tag/2.10.0/wallust.toml>
      '';
    };

    templates = mkOption {
      type = with types; listOf (submodule templateModule);
      default = [];

      example = ''
        # TODO
      '';
      description = "";
    };
  };

  config = mkIf cfg.enable {
    home.packages = [ pkgs.wallust ];
    
    xdg.configFile."wallust/wallust.toml" = mkIf (cfg.settings != {}) {
      source = tomlFormat.generate "wallust.toml" cfg.settings;
    };
  };

  meta.maintainers = [ hm.maintainers.temp ]; # TODO
}

Well anyways as you can see I was trying to re-export the template config option but I’m kinda struggling to find a way to add it to the config. I could use concatStringSep and generate multiple different tomls but that doesn’t seem like a nice solution.

Here’s an example toml config file

[[entry]]
template = "file"
target = "path"

And here’s what I want to make the nix equivalent

templates."~/templates/color.json".destination = ~/$XDG_CACHE_DIR/wal/color.json

Since this is my first time writing something apart from my config in nix I also don’t really understand how that syntax works.

In swayidle (my reference) that syntax just kinda worked out of nowhere after defining a list of submodules.

Also the nix syntax is obviously very different from ‘normal’ program languages. I understand the base syntax but there’s just a insane amount of std functions that everyone expects me to just magically know? Is there some resource apart from the nixOS manual I’m missing? I couldn’t find a full documentation of all the types there as an example. (I know about this but it’s not exhaustive Data Types - Nix Reference Manual)