{
  lib,
  pkgs,
  ...
}: let
  port = 3021;
in {
  imports = [./ollama.nix];

  localWebApps = {
    openwebui = {
      name = "OpenWebUI";
      genericName = "LLM";
      icon = ../icons/openwebui.png;
      inherit port;
      requires.containers = ["openwebui" "ollama"];
    };
  };

  services.podman = {
    containers.openwebui = let
      str = builtins.toString;
    in {
      # serviceName = "openwebui";
      image = "ghcr.io/open-webui/open-webui:main";
      ports = ["${str port}:${str port}"];
      environment = {
        WEBUI_AUTH = "False";
        PORT = "${str port}";
      };
      autostart = false;
      networks = ["ollama"];
      unitConfig = {Requires = ["podman-ollama.service"];};
      extraOptions = [
        "--health-cmd"
        (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/${str port}'")
      ];
    };
  };
}
