Skip to content

Commit

Permalink
feat(ollama): Get open-webui working for Ollama
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Feb 20, 2024
1 parent 6487559 commit c4b4907
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hosts/pc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
hashedPassword =
"$y$j9T$L.RrmE3CRSB.lQayiw2ZN/$vA4XkSR13yL016t3HaZ11uCN/sCmXqBcuUcSBxMjiPD";
home = "/home/mat";
extraGroups = [ "networkmanager" "wheel" "oci" ];
extraGroups = [ "networkmanager" "wheel" "oci" "podman" ];
};
powerManagement.cpuFreqGovernor = "performance";
hardware = {
Expand Down
15 changes: 13 additions & 2 deletions nixos-modules/open-webui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

# Download LLMs per api
# curl http://localhost:11434/api/pull -d '{ "name": "llama2" }'
{ config, ... }: {
{ config, pkgs, ... }:
let
open-webui = pkgs.fetchFromGitHub {
owner = "open-webui";
repo = "open-webui";
rev = "76a788939f92a7a7d9705f971b9ce6e27b249d31";
sha256 = "sha256-MWgERNvg3FX1N6GD11Zl27Ni/tuEoRyYNWPiLiHst2M=";
};
in {
virtualisation = {
podman = {
enable = true;
Expand All @@ -17,6 +25,9 @@
ports = [ "3000:8080" ];
# TODO figure out how to create the data directory declaratively
volumes = [ "${config.users.users.mat.home}/open-webui:/app/backend/data" ];
extraOptions = [ "--add-host=host.docker.internal:host-gateway" ];
extraOptions =
[ "--network=host" "--add-host=host.containers.internal:host-gateway" ];
environment = { OLLAMA_API_BASE_URL = "http://127.0.0.1:11434/api"; };
};
networking.firewall = { allowedTCPPorts = [ 80 443 8080 11434 3000 ]; };
}

0 comments on commit c4b4907

Please sign in to comment.