23 lines
575 B
Nix
23 lines
575 B
Nix
{ config, lib, pkgs, flakeRoot, ... }:
|
|
|
|
let
|
|
ollamaConfPath = flakeRoot + "/assets/conf/apps/ai/ollama/ollama.conf";
|
|
ollamaEnv = builtins.splitLines (builtins.readFile ollamaConfPath);
|
|
envVars = lib.genAttrs (ollamaEnv) (line: let
|
|
parts = builtins.splitString "=" line;
|
|
in
|
|
if lib.elemAt parts 0 == "" then
|
|
lib.mkForce {}
|
|
else
|
|
lib.mkForce { (lib.elemAt parts 0) = lib.elemAt parts 1; });
|
|
in
|
|
|
|
{
|
|
services.ollama = {
|
|
enable = true;
|
|
package = pkgs.ollama;
|
|
environmentVariables = envVars;
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
}
|