53 lines
1.4 KiB
Nix
Executable File
53 lines
1.4 KiB
Nix
Executable File
{ pkgs, pkgs-unstable, lib, host, nvidia, ... }:
|
|
|
|
{
|
|
environment.systemPackages = with pkgs-unstable; [
|
|
ollama
|
|
];
|
|
|
|
# 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 = {
|
|
# package = pkgs-unstable.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 = "*";
|
|
};
|
|
};
|
|
}
|