28 lines
533 B
Nix
28 lines
533 B
Nix
|
{ lib, config, pkgs, ... }:
|
||
|
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.my.services.ollama;
|
||
|
in
|
||
|
{
|
||
|
options.my.services.ollama = {
|
||
|
enable = mkEnableOption "ollama";
|
||
|
package = mkOption {
|
||
|
type = types.package;
|
||
|
default = pkgs.ollama;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
systemd.user.services.ollama = {
|
||
|
after = [ "network.target" ];
|
||
|
serviceConfig = {
|
||
|
Type = "simple";
|
||
|
Restart = "on-failure";
|
||
|
RestartSec = "1s";
|
||
|
ExecStart = "${getExe cfg.package} serve";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|