From f3a6146ff8ce9fabf28958b0dd8a0d03ab4ffbd3 Mon Sep 17 00:00:00 2001 From: shivaraj-bh Date: Fri, 14 Jun 2024 01:29:06 +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 ce757080..43fdbdd0 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