{
  description = "A simple NixOS flake";

  inputs = {
    # NixOS official package source, using unstable here
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nur = {
      url = "github:nix-community/NUR";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    catppuccin.url = "github:catppuccin/nix";
    home-manager = {
      url = "github:nix-community/home-manager/master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    hyprland.url = "github:hyprwm/Hyprland";
    plasma-manager = {
      url = "github:nix-community/plasma-manager";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };

    nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05";
    home-manager-stable = {
      url = "github:nix-community/home-manager/release-25.05";
      inputs.nixpkgs.follows = "nixpkgs-stable";
    };
  };

  outputs = {
    self,
    catppuccin,
    nur,
    plasma-manager,
    ...
  } @ inputs: let
    hosts = import ./hosts/hosts.nix;

    # Make config for non-NixOS hosts
    mkHomeConfiguration = {
      host,
      nixpkgs,
      home-manager,
      modules ? [],
    }:
      home-manager.lib.homeManagerConfiguration {
        pkgs = import nixpkgs {
          system = host.arch;
          config = {
            allowUnfree = true;
          };
          overlays = [
            nur.overlay
          ];
        };
        modules =
          [
            ./hosts/${host.dir}/home.nix
            catppuccin.homeModules.catppuccin
          ]
          ++ modules;
      };

    # Make config for NixOS hosts
    mkNixOSConfigurations = {
      host,
      nixpkgs,
      home-manager,
      modules ? [],
    }:
      nixpkgs.lib.nixosSystem {
        system = host.arch;
        specialArgs = {inherit inputs;};
        modules =
          [
            ./hosts/${host.dir}/configuration.nix
            nur.modules.nixos.default
            catppuccin.nixosModules.catppuccin
            home-manager.nixosModules.home-manager
            {
              home-manager.backupFileExtension = "backup";
              home-manager.useGlobalPkgs = true;
              home-manager.users."${host.user}".imports = [
                ./hosts/${host.dir}/home.nix
                catppuccin.homeModules.catppuccin
              ];
            }
          ]
          ++ modules;
      };
  in {
    # Please replace my-nixos with your hostname
    nixosConfigurations = {
      "anzu" = mkNixOSConfigurations {
        host = hosts.anzu;
        nixpkgs = inputs.nixpkgs;
        home-manager = inputs.home-manager;
        modules = [
          {
            home-manager.sharedModules = [plasma-manager.homeManagerModules.plasma-manager];
          }
        ];
      };
      "ichigo" = mkNixOSConfigurations {
        host = hosts.ichigo;
        nixpkgs = inputs.nixpkgs;
        home-manager = inputs.home-manager;
        modules = [
          {
            home-manager.sharedModules = [plasma-manager.homeManagerModules.plasma-manager];
          }
        ];
      };
    };
  };
}
