From 2d50efec563f258e243737f9be970908a2c14e9a Mon Sep 17 00:00:00 2001 From: Simon Parri Date: Wed, 1 Oct 2025 10:43:53 -0500 Subject: modules/ollama: Create by factoring common code from bean/*, tomato --- modules/default.nix | 1 + modules/ollama.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 modules/ollama.nix (limited to 'modules') diff --git a/modules/default.nix b/modules/default.nix index fb09c0b..4baf4b7 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -15,6 +15,7 @@ ./bluetooth.nix ./unfree.nix ./build-machines.nix + ./ollama.nix ./apache ./overlays ]; diff --git a/modules/ollama.nix b/modules/ollama.nix new file mode 100644 index 0000000..7bbcfd1 --- /dev/null +++ b/modules/ollama.nix @@ -0,0 +1,26 @@ +{ lib, pkgs, config, inputs, ... }: + +let + nixpkgs-unstable = inputs.nixpkgs-unstable. + legacyPackages.x86_64-linux; + cfg = config.this.ollama; +in +{ + options = { + this.ollama = { + enable = lib.mkEnableOption "ollama"; + unstable = lib.mkEnableOption "unstable ollama package" + // { default = true; }; + }; + }; + + config = lib.mkIf cfg.enable { + services.ollama = { + enable = true; + package = lib.mkIf cfg.unstable nixpkgs-unstable.ollama; + environmentVariables = { + OLLAMA_CONTEXT_LENGTH = "8192"; + }; + }; + }; +} -- cgit v1.2.3