Cannot get correct yaml out of pkgs.formats.yaml

Hi. I am trying to modify my homepage instance services.homepage-dashboard.services.
This option uses pkgs.formats.yaml on the backend to generate a yaml file.
I need this yaml file to be in the format:

- Group A:
    - Service A:
        href: http://localhost/

    - Service B:
        href: http://localhost/

I now I can get some of the way there by doing

[{
 "Group A" = [{
    "Service A" = {
      href = "http://localhost/";
    };
    "Service A" = {
      href = "http://localhost/";
    };
  }];
}]

This however gives the output

- Group A:
    - Service B:
        href: http://localhost/

      Service A:
        href: http://localhost/

What do I write to get both services to be part of the list.

Code to test in home manager

xdg.configFile."some/config.yaml".source =
  (pkgs.formats.yaml { }).generate "something" ... ;

Your YAML example contains:

  1. A list
  2. That list contains a map
  3. That map contains a single element with key “Group A”.
  4. That element’s value is a list
  5. The first element of that list is a map with one key called “Service A”, and the value for that key is a map {"href": "http://localhost"}.
  6. The second element of that list is another map with one key called “Service B”

Are you absolutely sure that this format is what you need? If so, you need to have this in your Nix code:

[{
  "Group A" = [
    # List item number 1
    {
      "Service A" = {
        href = "http://localhost/";
      };
    }

    # List item number 2
    {
      "Service B" = {
        href = "http://localhost/";
      };
    }
  ];
}]

I.e., the value of key “Group A” is not a list with a single attribute set having two keys, but a list with two attribute sets, having one key each.

Thank you.
Yes this is what I need. It is written in the homepage documentation.