{ pkgs, ... }:

let
  salespage = pkgs.runCommand "salespage" {} ''
    mkdir -p $out
    ${pkgs.pandoc}/bin/pandoc \
      --standalone \
      -f commonmark_x \
      --include-in-header ${./Que/Style.css} \
      --include-in-header ${./Nixpert/ChatWidget.html} \
      -t html \
      ${./Nixpert.md} \
      > $out/index.html
  '';
in {
  services.nginx.virtualHosts."nixpert.chat" = {
    forceSSL = true;
    enableACME = true;
    locations."/" = {
      root = "${salespage}";
      extraConfig = ''
        add_header Access-Control-Allow-Origin "*";
      '';
    };
  };
}