{
description = "System conf";
inputs = {
  nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

  nixos-hardware.url = "github:NixOS/nixos-hardware";
  mobile-nixos.url = "github:mobile-nixos/mobile-nixos";
  mobile-nixos.flake = false;

  sxmo.url = "github:wentam/sxmo-nix";
  sxmo.flake = false;

  home-manager.url = "github:nix-community/home-manager/master";
  home-manager.inputs.nixpkgs.follows = "nixpkgs";

  quickshell-toki-night.url = "https://git.tokinanpa.dev/toki/quickshell-toki-night/archive/main.tar.gz";
  quickshell-toki-night.inputs.nixpkgs.follows = "nixpkgs";
  quickshell-toki-night.inputs.systems.url = "github:nix-systems/x86_64-linux";

  tokyo-night-sddm-src.url = "github:rototrash/tokyo-night-sddm";
  tokyo-night-sddm-src.flake = false;
  macos-hyprcursor-src.url = "github:driedpampas/macOS-hyprcursor";
  macos-hyprcursor-src.flake = false;
};
outputs = { self,
            nixpkgs,
            home-manager,
            nixos-hardware,
            mobile-nixos,
            sxmo,
...}@inputs:
  let
    username = "kiana";
    fullname = "Kiana Sheibani";
    email = "kiana.a.sheibani@gmail.com";

    moduleArgs = { inherit username fullname email; } // inputs;

    mkConfig =
      { machine,
        configModules ? [ ./config ],
        configExtraModules ? [],
        homeModules ? [ ./home-manager ],
        homeExtraModules ? []
      }:
      {
        "toki-${machine}" = nixpkgs.lib.nixosSystem {
          modules =
            configModules ++
            configExtraModules ++
            [
              ./machine.nix
              { _module.args = moduleArgs;
                inherit machine; }
              ./hardware-configuration/${machine}.nix
              home-manager.nixosModules.home-manager
              {
                home-manager.useGlobalPkgs = true;
                home-manager.useUserPackages = true;
                home-manager.extraSpecialArgs = moduleArgs;

                home-manager.sharedModules = [ ./machine.nix { inherit machine; } ];
                home-manager.users.${username} = {
                  imports = homeModules ++ homeExtraModules;
                };
              }
            ];
        };
      };
  in {
    nixosConfigurations =
      mkConfig {
        machine = "earth";
      } //
      mkConfig {
        machine = "fire";
        configExtraModules = [
          nixos-hardware.nixosModules.microsoft-surface-pro-intel
        ];
      } //
      mkConfig {
        machine = "air";
        configExtraModules = [
          ./mobile/config.nix
          (import (mobile-nixos + /lib/configuration.nix)
            { device = "pine64-pinephonepro"; })
          (sxmo + /modules/sxmo)
          (sxmo + /modules/tinydm)
        ];
        homeModules = [
          ./mobile/home-manager.nix
        ];
      };
  };
}
