4 webuiName = "NixOS Test";
8 meta = with lib.maintainers; {
9 maintainers = [ shivaraj-bh ];
16 services.open-webui = {
19 # Requires network connection
20 RAG_EMBEDDING_MODEL = "";
23 # Test that environment variables can be
24 # overridden through a file.
25 environmentFile = config.node.pkgs.writeText "test.env" ''
26 WEBUI_NAME="${webuiName}"
34 import xml.etree.ElementTree as xml
38 machine.wait_for_unit("open-webui.service")
39 machine.wait_for_open_port(${mainPort})
41 machine.succeed("curl http://127.0.0.1:${mainPort}")
43 # Load the Web UI config JSON and parse it.
44 webui_config_json = machine.succeed("curl http://127.0.0.1:${mainPort}/api/config")
45 webui_config = json.loads(webui_config_json)
47 # Check that the name was overridden via the environmentFile option.
48 assert webui_config["name"] == "${webuiName} (Open WebUI)"
50 webui_opensearch_xml = machine.succeed("curl http://127.0.0.1:${mainPort}/opensearch.xml")
51 webui_opensearch = xml.fromstring(webui_opensearch_xml)
53 webui_opensearch_url = webui_opensearch.find(
54 ".//{http://a9.com/-/spec/opensearch/1.1/}Url"
57 webui_opensearch_url is not None
58 ), f"no url tag found in {webui_opensearch_xml}"
60 webui_opensearch_url.get("template") == "http://localhost:8080/?q={searchTerms}"
61 ), "opensearch url doesn't match the configured port"