local ollama for vscode
This commit is contained in:
parent
5786863608
commit
f9371908d6
6 changed files with 107 additions and 46 deletions
70
flake.lock
generated
70
flake.lock
generated
|
@ -238,11 +238,11 @@
|
|||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725976743,
|
||||
"narHash": "sha256-pLQQbiC9uO4lF58fAnlcDxlbsBB1XFWswsU1oZOIVqU=",
|
||||
"lastModified": 1726394915,
|
||||
"narHash": "sha256-guDSphIBbkUGI9LQDAls4PUDDJFl9URC0EAUKb+sjks=",
|
||||
"owner": "helix-editor",
|
||||
"repo": "helix",
|
||||
"rev": "237cbe4bca46eed52efed39ed75eb44aaccbdde3",
|
||||
"rev": "5ce77de0dc7106c6f1460d80a3c5a51eaea3108c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -291,11 +291,11 @@
|
|||
"lix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1725927421,
|
||||
"narHash": "sha256-tiQ9OxiuTb/02xEU2ceo9MIxWBS5Rm/IAhv6QshH8K0=",
|
||||
"rev": "cc183fdbc14ce105a5661d646983f791978b9d5c",
|
||||
"lastModified": 1726411950,
|
||||
"narHash": "sha256-OnPGWKN3mJCsbdt4zOCVSTWg8N9QX+VTCXDcYviStTk=",
|
||||
"rev": "80202e3ca314c21547c48f3a23d3f629cd9ddb87",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/cc183fdbc14ce105a5661d646983f791978b9d5c.tar.gz?rev=cc183fdbc14ce105a5661d646983f791978b9d5c"
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/80202e3ca314c21547c48f3a23d3f629cd9ddb87.tar.gz?rev=80202e3ca314c21547c48f3a23d3f629cd9ddb87"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
|
@ -360,8 +360,8 @@
|
|||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726012053,
|
||||
"narHash": "sha256-wGfFI8ZD3+TisEW2cFUABbtWYpn0N71CpkiXuITOk88=",
|
||||
"lastModified": 1726458116,
|
||||
"narHash": "sha256-KKLTbh0abZXV9OzH5vV4xLiTDsj9cS35YKiIzBIQ3Hw=",
|
||||
"path": "/home/bolt/code/meat",
|
||||
"type": "path"
|
||||
},
|
||||
|
@ -393,11 +393,11 @@
|
|||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725765290,
|
||||
"narHash": "sha256-hwX53i24KyWzp2nWpQsn8lfGQNCP0JoW/bvQmcR1DPY=",
|
||||
"lastModified": 1726449931,
|
||||
"narHash": "sha256-1AX7MyYzP7sNgZiGF8jwehCCI75y2kBGwACeryJs+yE=",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "642275444c5a9defce57219c944b3179bf2adaa9",
|
||||
"rev": "c1b0fa0bec5478185eae2fd3f39b9e906fc83995",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -438,15 +438,15 @@
|
|||
"treefmt-nix": "treefmt-nix_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725635983,
|
||||
"narHash": "sha256-haSfwdurfltqQ/7YEmDcmWLnWwvAgelIHnXsHG34P1k=",
|
||||
"owner": "lilyinstarlight",
|
||||
"lastModified": 1726334963,
|
||||
"narHash": "sha256-L8ICz9iELkvQl/ufdSWy9lRm8DLNpKDFxoeHQfPu4E8=",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-update",
|
||||
"rev": "ed54a7546affb3f8c9c3e10a6fa6fdb21756ec8f",
|
||||
"rev": "84d7535d076c5e06fba272738448c80698eb3d40",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lilyinstarlight",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-update",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -481,11 +481,11 @@
|
|||
"rust-overlay": "rust-overlay_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726010864,
|
||||
"narHash": "sha256-bOn5vl87FYeTqR0ymYJxYHFrIdjTSeN3GtqlPlK+2os=",
|
||||
"lastModified": 1726453173,
|
||||
"narHash": "sha256-GnFxniWjQYqg9cAqHj7E+EEip1nZdvcUOH/StIod++c=",
|
||||
"owner": "lilyinstarlight",
|
||||
"repo": "nixos-cosmic",
|
||||
"rev": "f6c0035d0ab8a689d32128bb10e5c6b9fca78e9d",
|
||||
"rev": "9907e5b7f5cbe92c97fd922b562dba691d3d8585",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -561,11 +561,11 @@
|
|||
},
|
||||
"nixpkgs-stable_2": {
|
||||
"locked": {
|
||||
"lastModified": 1725826545,
|
||||
"narHash": "sha256-L64N1rpLlXdc94H+F6scnrbuEu+utC03cDDVvvJGOME=",
|
||||
"lastModified": 1726320982,
|
||||
"narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f4c846aee8e1e29062aa8514d5e0ab270f4ec2f9",
|
||||
"rev": "8f7492cce28977fbf8bd12c72af08b1f6c7c3e49",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -593,11 +593,11 @@
|
|||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1725634671,
|
||||
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
|
||||
"lastModified": 1726062873,
|
||||
"narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
|
||||
"rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -641,11 +641,11 @@
|
|||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1725634671,
|
||||
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
|
||||
"lastModified": 1726243404,
|
||||
"narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
|
||||
"rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -657,11 +657,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1726004797,
|
||||
"narHash": "sha256-EjbaRc4eu8cnR4rF5y6EMWZG8mtJa9BQq4z0hsQMIZg=",
|
||||
"lastModified": 1726524519,
|
||||
"narHash": "sha256-dQ4uRthSynzI8nNYISYmoKMH2cKW/RgiePykb87jBXU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "7992767e0d354cfedc418887d4c10aed4515c962",
|
||||
"rev": "023b6b20cf5250d9ee0fd4713775dac9f696e407",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -753,11 +753,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725848835,
|
||||
"narHash": "sha256-u4lCr+tOEWhsFiww5G04U5jUNzaQJi0/ZMIDGiLeT14=",
|
||||
"lastModified": 1726382494,
|
||||
"narHash": "sha256-T7W+ohiXe1IY0yf/PpS4wQItZ0SyRO+/v8kqNpMXlI4=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "2ef910a6276a2f34513d18f2f826a8dea72c3b3f",
|
||||
"rev": "ff13821613ffe5dbfeb4fe353b1f4bf291d831db",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
BIN
home/icons/anythingllm.png
Normal file
BIN
home/icons/anythingllm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -1,13 +1,13 @@
|
|||
{pkgs, ...}: {
|
||||
# home.packages = with pkgs; [
|
||||
# gtk-engine-murrine
|
||||
# ];
|
||||
home.packages = with pkgs; [
|
||||
gtk-engine-murrine
|
||||
];
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
qt = {
|
||||
enable = true;
|
||||
# style.name = "adwaita-dark";
|
||||
# platformTheme.name = "adwaita";
|
||||
style.name = "adwaita-dark";
|
||||
platformTheme.name = "adwaita";
|
||||
};
|
||||
|
||||
gtk = with pkgs;
|
||||
|
|
|
@ -11,7 +11,7 @@ in {
|
|||
anything-llm = {
|
||||
name = "Anything LLM";
|
||||
genericName = "Chatbot";
|
||||
icon = ../icons/openwebui.png;
|
||||
icon = ../icons/anythingllm.png;
|
||||
inherit port;
|
||||
requires.containers = ["anything-llm" "ollama"];
|
||||
};
|
||||
|
@ -22,16 +22,29 @@ in {
|
|||
username = config.mainUser;
|
||||
in {
|
||||
image = "mintplexlabs/anythingllm";
|
||||
devices = ["nvidia.com/gpu=all"];
|
||||
ports = ["${str port}:3001"];
|
||||
autostart = false;
|
||||
networks = ["ollama"];
|
||||
volumes = let
|
||||
share = "/home/${username}/.local/share/anything-llm";
|
||||
home = "/home/${username}";
|
||||
share = "${home}/.local/share/anything-llm";
|
||||
in [
|
||||
"${share}:/storage"
|
||||
"${share}:/app/server/storage"
|
||||
"${share}/.env:/app/server/.env"
|
||||
"${share}/config:/home/anythingllm/.config/anythingllm-desktop"
|
||||
"${share}/config:/home/${username}/.config/anythingllm-desktop"
|
||||
];
|
||||
environment.STORAGE_LOCATION = "/storage";
|
||||
environment = {
|
||||
STORAGE_DIR = "/app/server/storage";
|
||||
LLM_PROVIDER = "ollama";
|
||||
OLLAMA_BASE_PATH = "http://ollama:11434";
|
||||
EMBEDDING_ENGINE = "ollama";
|
||||
EMBEDDING_BASE_PATH = "http://ollama:11434";
|
||||
VECTOR_DB = "lancedb";
|
||||
WHISPER_PROVIDER = "local";
|
||||
TTS_PROVIDER = "native";
|
||||
};
|
||||
unitConfig = {Requires = ["podman-ollama.service"];};
|
||||
extraOptions = [
|
||||
"--health-cmd"
|
||||
|
|
|
@ -1,8 +1,54 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
xdg.desktopEntries.ollama = {
|
||||
name = "Ollama";
|
||||
type = "Application";
|
||||
icon = ../icons/ollama.png;
|
||||
exec = let
|
||||
inherit (lib) getExe getExe';
|
||||
notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"Ollama\"";
|
||||
systemctl = "${getExe' pkgs.systemd "systemctl"}";
|
||||
podman = "${getExe pkgs.podman}";
|
||||
in "${pkgs.writeShellScript "ollama" ''
|
||||
set -euo pipefail
|
||||
|
||||
exit_error() {
|
||||
${notify-send} -w "Failure" $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
container_checks() {
|
||||
if [ "$(${podman} inspect -f {{.State.Health.Status}} ollama)" == "healthy" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
${notify-send} "Launching Ollama.." "Please be patient."
|
||||
|
||||
${systemctl} --user start podman-ollama
|
||||
checks=0
|
||||
until container_checks; do
|
||||
sleep 2
|
||||
checks=$((checks+1))
|
||||
if [ $((checks%10)) -eq 0 ]; then
|
||||
${notify-send} "Launching.."
|
||||
fi
|
||||
if [ $checks -ge 60 ]; then
|
||||
${systemctl} --no-block --user stop podman-ollama.target
|
||||
exit_error "Failed to launch!"
|
||||
fi
|
||||
done
|
||||
|
||||
${notify-send} "Ollama serving on port 11434."
|
||||
''}";
|
||||
};
|
||||
|
||||
services.podman = {
|
||||
containers.ollama = let
|
||||
username = config.mainUser;
|
||||
|
@ -11,6 +57,7 @@
|
|||
devices = ["nvidia.com/gpu=all"];
|
||||
autostart = false;
|
||||
networks = ["ollama"];
|
||||
ports = ["11434:11434"];
|
||||
volumes = [
|
||||
"/home/${username}/.local/share/ollama:/models"
|
||||
];
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
replaceStrings
|
||||
concatMapStringsSep
|
||||
;
|
||||
partOf = cfg: "${replaceStrings [" "] ["-"] (toLower cfg.name)}.target";
|
||||
# make a firefox webapp + hidden .desktop entry for the client app
|
||||
make-firefox = cfg:
|
||||
mapAttrs' (
|
||||
|
@ -60,7 +61,7 @@
|
|||
name = "${req}";
|
||||
value = {
|
||||
Unit = {
|
||||
PartOf = "${replaceStrings [" "] ["-"] (toLower cfg.name)}.target";
|
||||
PartOf = partOf cfg;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -75,7 +76,7 @@
|
|||
name = "${req}";
|
||||
value = {
|
||||
unitConfig = {
|
||||
PartOf = "${toLower cfg.name}.target";
|
||||
PartOf = partOf cfg;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue