{
  inputs,
  self,
  ...
}: {
  flake.lib = inputs.nixpkgs.lib.extend (_: _: {
    mkHost = {
      host,
      system,
      extraModules ? [],
    }:
      inputs.nixpkgs.lib.nixosSystem {
        inherit system;
        modules =
          extraModules
          ++ [
            ../hosts/${host}
            inputs.self.nixosModules.default
            ({config, ...}: {
              config = {
                nix = {
                  settings.extra-experimental-features = [
                    "nix-command"
                    "flakes"
                  ];
                  gc = {
                    automatic = true;
                    dates = "weekly";
                  };
                };
                nixpkgs.config.allowUnfree = true;
                environment.shellAliases = {
                  rebs = "nixos-rebuild --use-remote-sudo switch --flake .#${host}";
                  rebt = "nixos-rebuild --use-remote-sudo test --flake .#${host}";
                };
                networking.hostName = host;
                systemd.oomd = {
                  enableRootSlice = true;
                };
              };
            })
          ];
        specialArgs = {
          inherit inputs self;
        };
      };
  });
}
