{
  system,
  inputs,
  sharedModules,
  ...
}:
with inputs;
let
  nix-rice = import "${inputs.nix-rice}/lib.nix" {
    inherit (nixpkgs) lib;
    kitty-themes-src = { };
  };
  rice = import ./rice {
    inherit
      inputs
      system
      nix-rice
      ;
  };
in
{
  systems =
    definitions:
    nixpkgs.lib.mapAttrs (
      name: info:
      nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = {
          inherit inputs rice;
          mainUser = info.user;
        };
        modules =
          [
            ./system/${name}.nix
            home-manager.nixosModules.home-manager
            {
              home-manager = {
                useGlobalPkgs = true;
                extraSpecialArgs = {
                  inherit inputs rice nix-rice;
                  mainUser = info.user;
                };
                users.${info.user}.imports = [
                  ./home/${info.user}.nix
                ] ++ info.hmImports or [ ];
              };
            }
          ]
          ++ info.imports or [ ]
          ++ sharedModules;
      }
    ) definitions;
}
