{ ... }:
{
  _class = "clan.service";
  manifest.name = "common-user-home-manager";
  manifest.description = "General users' home-manager profile generator";
  manifest.readme = "General users' home-manager profile generator";
  manifest.categories = [ "System" ];

  roles.default = {
    description = "a default role for the user";
    interface =
      { lib, ... }:
      {
        options = {
          username = lib.mkOption {
            type = lib.types.str;
          };
          kbLayout = lib.mkOption {
            type = lib.types.str;
            default = "us";
          };
          kbOptions = lib.mkOption {
            type = lib.types.str;
            default = "grp:win_space_toggle";
          };
        };
      };
    perInstance =
      { settings, ... }:
      {
        nixosModule =
          { inputs, ... }:
          let
            username = settings.username;
          in
          {
            imports = [ inputs.home-manager.nixosModules.home-manager ];

            users.users.${username} = {
              initialPassword = "";
              isNormalUser = true;
              extraGroups = [
                "audio"
                "video"
                "networkmanager"
              ];
            };

            services.xserver = {
              enable = true;
              xkb.layout = settings.kbLayout;
              xkb.options = settings.kbOptions;
            };

            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.${username} = ./home.nix;
            home-manager.extraSpecialArgs = {
              inherit inputs username;
            };
          };
      };
  };
}
