ollama official service

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-05-17 17:06:42 +02:00
parent 1685b27e36
commit 34c2a7eb4a
3 changed files with 47 additions and 35 deletions

View File

@@ -27,6 +27,9 @@
insert = "bar"; insert = "bar";
select = "underline"; select = "underline";
}; };
soft-wrap = {
enable = true;
};
line-number = "relative"; line-number = "relative";
color-modes = true; color-modes = true;
bufferline = "always"; bufferline = "always";
@@ -44,6 +47,7 @@
newline = ""; newline = "";
tab = ""; tab = "";
}; };
}; };
}; };
languages.language = [{ languages.language = [{
@@ -175,7 +179,7 @@
}; };
"ui.statusline" = { "ui.statusline" = {
"fg" = blue.bright; "fg" = blue.bright;
# "bg" = black.base; "bg" = black.base;
}; };
"ui.statusline.inactive" = { "ui.statusline.inactive" = {
"fg" = red.bright; "fg" = red.bright;

View File

@@ -1,4 +1,4 @@
{ config, pkgs, pkgs-unstable, inputs, host, user, nvidia, rice, lib, ... }: { pkgs, pkgs-unstable, inputs, host, user, nvidia, rice, lib, ... }:
let let
animation-speed = "2"; animation-speed = "2";
transparency = builtins.toString rice.transparency; transparency = builtins.toString rice.transparency;

View File

@@ -1,43 +1,51 @@
{ config, pkgs, lib, system, user, host, allowed, secrets, ... }: { pkgs, lib, host, nvidia, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
ollama ollama
]; ];
services.ollama.environmentVariables = { # services.ollama.environmentVariables = {
# OLLAMA_ORIGINS = "*";
# };
# systemd.services.ollama = {
# environment.OLLAMA_ORIGINS = "*";
# description = "Ollama Service";
# after = [ "network-online.target" "ollama-doesnt-respect-xdg-data-home.service" ];
# serviceConfig = {
# Type = "simple";
# # Environment = "\"XDG_DATA_HOME=/run/current-system/sw/share\"";
# ExecStart = "${pkgs.ollama}/bin/ollama serve";
# User = "ollama";
# Group = "ollama";
# Restart = "always";
# RestartSec = "3";
# };
# wantedBy = [ "default.target" ];
# };
# users.users.ollama = {
# isSystemUser = true;
# home = "/usr/share/ollama";
# shell = "/bin/false";
# group = "ollama";
# };
# users.groups.ollama = {};
# systemd.services.ollama-doesnt-respect-xdg-data-home = {
# wantedBy = ["multi-user.target"];
# script = ''
# mkdir -p /usr/share/ollama/.ollama
# chown ollama:ollama -R /usr/share/ollama
# '';
# };
services.ollama = {
enable = true;
acceleration = lib.mkIf nvidia.enable "cuda";
listenAddress = if host == "NxACE" then "0.0.0.0:11434" else "127.0.0.1:11434";
environmentVariables = {
OLLAMA_ORIGINS = "*"; OLLAMA_ORIGINS = "*";
}; };
systemd.services.ollama = {
environment.OLLAMA_ORIGINS = "*";
description = "Ollama Service";
after = [ "network-online.target" "ollama-doesnt-respect-xdg-data-home.service" ];
serviceConfig = {
Type = "simple";
# Environment = "\"XDG_DATA_HOME=/run/current-system/sw/share\"";
ExecStart = "${pkgs.ollama}/bin/ollama serve";
User = "ollama";
Group = "ollama";
Restart = "always";
RestartSec = "3";
};
wantedBy = [ "default.target" ];
};
users.users.ollama = {
isSystemUser = true;
home = "/usr/share/ollama";
shell = "/bin/false";
group = "ollama";
};
users.groups.ollama = {};
systemd.services.ollama-doesnt-respect-xdg-data-home = {
wantedBy = ["multi-user.target"];
script = ''
mkdir -p /usr/share/ollama/.ollama
chown ollama:ollama -R /usr/share/ollama
'';
}; };
} }