# colmena.nix - Separate file to keep flake.nix clean
{
  inputs,
  outputs,
}: let
  inherit (inputs.nixpkgs) lib;

  # Helper to create a host configuration
  mkHost = {
    hostname,
    profile ? "proxmox-vm",
    modules ? [],
    specialArgs ? {},
  }: {
    imports =
      [
        # Base profile (determines hardware/platform specifics)
        (./. + "/profiles/${profile}.nix")
        # Host-specific configuration
        (./. + "/hosts/${hostname}")
        # Additional modules
      ]
      ++ modules;

    # Pass through special args and our outputs
    _module.args =
      specialArgs
      // {
        inherit inputs outputs;
      };
  };
in {
  meta = {
    nixpkgs = import inputs.nixpkgs {
      system = "x86_64-linux";
      overlays = [
        outputs.overlays.additions
        outputs.overlays.modifications
        outputs.overlays.unstable-packages
        inputs.colmena.overlays.default
      ];
    };

    specialArgs = {inherit inputs outputs;};
  };

  defaults = import ./hosts/default.nix;

  # Define your hosts
  sandbox = mkHost {
    hostname = "sandbox";
    profile = "proxmox-vm";
  };

  photos = mkHost {
    hostname = "photos";
    profile = "proxmox-vm";
  };
}
