Outsource flake module to another git repository

I would like to outsource a module to another git repo. In my concrete case I have a nixvim configuration that I want to use in all my nixos configurations. So my hope was that I could just have a git repo with that module in it and import it in a similar fasion to this

{
#...
inputs = {
#...
  my_config.url = "github:owner/repo";
};

outputs = {self, nixpkgs, home-manager, ... }@inputs : {
  nixosConfigurations = {
    my-host = nixpkgs.lib.nixosSystem  {
      # ...
      modules = [
        ${inputs.my_config}/some_module.nix
      ];
    }
  };
};
}

I tried numerous alternatives (which tells me that infinite recursion happens) but unfortunately did not succeed. I was also not able to find a solution for this problem online. Would be great if someone had an idea on how to achieve this

I’m going through similar woes, trying to import a module from another flake. Maybe try this in the outputs of your my_config flake:

nixosModules = { some_module = import ./some_module.nix; };

Then in your nixosSystem modules above, do:

      modules = [
        inputs.my_config.nixosModules
      ];

or perhaps

      modules = [
        inputs.my_config.nixosModules.some_module
      ];

Full disclosure, I haven’t gotten it to work either but maybe you’ll have better luck lol.