Split modules into a separate repository

Would it be possible to split out all the generic modules into a separate repository and import them into a flake?
I have currently 4 systems in my flake which starts to be a bit much.
I imaging a system which as a roles/features repo which I then can define as an input and in the configuration I could do something like this:

  description = "Nixos configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
    roles.url = "github:Nebucatnetzer/nix-roles";

  outputs =
    inputs @ { self, nixpkgs, roles }:
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config = {
          allowUnfree = true;
     nixosConfigurations.nixos-vm = nixpkgs.lib.nixosSystem {
        inherit system pkgs roles;
        modules = [

Is this possible?
Do I have to do something special with the existing modules or could the be used 1:1?
What about the roles repo?

There’s a nixosModules output exactly for this purpose. I believe it would work just the way you drafted up there, but the compiler will probably disagree with something.

I’ve been following a similar workflow, with my dotfiles living in a separate repository. I’m not sure I would recommend this, it makes it harder to update using CI and creates twice the manual overhead.

Yes managing two repos for one change can be a PITA.
I’ll check if I can do something with the output you mentioned.