Declarative docker contexts result in "invalid cross-device link"

I am trying to declare docker contexts. For instance:

  home-manager.users.sh4k0 = {
    programs.docker-cli = {
      enable = true;
      contexts = {
        test1_docker = {
          Endpoints.docker.Host = "ssh://user@test1.domain.org";
        };
        test2_docker = {
          Endpoints.docker.Host = "ssh://user@test2.domain.org:2222";
        };
      };
    };
  };
};

The expression evaluates correctly and I find the corresponding contexts in ~/.docker/contexts, but attempting to use any of them (docker context use test1_docker) results in:

rename /home/sh4k0/.docker/config.json57492226 /nix/store/fync9xfg6iz3sswz8cxa00hfczmq94ah-config.json: invalid cross-device link

If I imperatively set the same options, everything works accordingly and I can use the contexts. So, I suspect the above error happens because docker seemingly doesn’t like contexts being symlinks to paths in the Nix store.

Is there a way I can declaratively set docker contexts?