From db7ab711d9a6cefd28dbcfe58409d3a968a3b713 Mon Sep 17 00:00:00 2001 From: shivaraj-bh Date: Fri, 14 Jun 2024 02:57:57 +0530 Subject: [PATCH] fix(ollama): Broken `dataDir` convention; Allow ENVs in `dataDir` Easy to break the convention, see: https://github.com/juspay/services-flake/issues/200 double-quotting in shell script prevents globbing: https://www.shellcheck.net/wiki/SC2086 --- nix/ollama.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/ollama.nix b/nix/ollama.nix index ce75708..43fdbdd 100644 --- a/nix/ollama.nix +++ b/nix/ollama.nix @@ -30,7 +30,7 @@ in }; dataDir = lib.mkOption { type = types.str; - default = "./data/ollama"; + default = "./data/${name}"; description = '' The directory containing the Ollama models. Sets the `OLLAMA_MODELS` environment variable. @@ -93,9 +93,9 @@ in startScript = pkgs.writeShellApplication { name = "ollama-server"; text = '' - if [ ! -d ${config.dataDir} ]; then + if [ ! -d "${config.dataDir}" ]; then echo "Creating directory ${config.dataDir}" - mkdir -p ${config.dataDir} + mkdir -p "${config.dataDir}" fi ${lib.getExe config.package} serve