{ inputs, lib, channels, ... }:

# Clicks modules must fulfil a contract consisting of 2 items:
# - They must evaluate when running with only the NixOS modules and other Clicks
#   modules
# - They must not change config without being enabled
#
# We can pretty eloquently test for both of these by evaluating our modules with
# just the nixpkgs modules, and then doing the same thing without our modules
{
  testEmptyEvalMayNotChangeOutput = let
    neededForEval = [
      {
        system.stateVersion = "24.05";
      }
      {
        fileSystems."/" = {
          device = "none";
          fsType = "tmpfs";
        };
      }
      {
        boot.loader.grub.device = "nodev";
      }
      {
        nixpkgs.config = {
          allowBroken = true;
          allowUnfree = true;
        };
      }
    ];
    libPlusClicks = lib.attrsets.recursiveUpdate channels.unstable.lib {
      clicks = lib.clicks; # Our own lib is permitted as a requirement... but we're doing this song/dance to stop us, say, relying on snowfall lib/agenix lix/whatever...
    };
  in {
    expr = (inputs.unstable.lib.nixosSystem {
      lib = libPlusClicks;
      system = channels.unstable.system;
      modules = (lib.attrsets.attrValues inputs.self.nixosModules) ++ neededForEval;
    }).config.system.build.toplevel.outPath;
    expected = (inputs.unstable.lib.nixosSystem {
      lib = libPlusClicks;
      system = channels.unstable.system;
      modules = neededForEval;
    }).config.system.build.toplevel.outPath;
  };
}
