{
	description = "My System Configs";

	inputs = {
		nixpkgs.url = "nixpkgs/nixos-unstable";

		i3utils.url = "git+https://git.sr.ht/~dpatterbee/i3utils?ref=main";

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

	outputs = { nixpkgs, home-manager, i3utils, ... }: 
	let
		system = "x86_64-linux";

		pkgs = import nixpkgs {
			inherit system;

			config = {
				allowUnfree = true;
			};
		};

		lib = nixpkgs.lib;

		hostSystem = { hostname }: lib.nixosSystem {
			inherit system;

			modules = [
				./hosts/${hostname}/configuration.nix
				({ pkgs, ... }: {
					nixpkgs.overlays = [ i3utils.overlay ];
				})
			];
		};

		mkUserConf = { hostname, extraSauce ? [] }:
		home-manager.lib.homeManagerConfiguration {
			inherit system pkgs;

			username = "daniel";
			homeDirectory = "/home/daniel";
			configuration = {
				imports = [
					./user/daniel/home.nix
					({ pkgs, ... }: {
						nixpkgs.overlays = [ i3utils.overlay ];
					})
				] ++ extraSauce;
			};
			stateVersion = "21.05";
		};


	in {
		homeConfigurations = {
			daniel-dingbox = mkUserConf { 
				hostname = "dingbox"; 
				extraSauce = [ ./user/host-specific/dingbox ];
			};
			daniel-miniding = mkUserConf {
				hostname = "miniding";
				extraSauce = [ ./user/host-specific/miniding ];
			};
		};

		nixosConfigurations = {
			dingbox = hostSystem { hostname = "dingbox"; };
			miniding = hostSystem { hostname = "miniding"; };
			dingserver = hostSystem { hostname = "dingserver"; };
		};
	};
}
