diff --git a/home-manager/progs/gpt4all/gpt4all.nix b/home-manager/progs/gpt4all/gpt4all.nix index 2d7fe66..87ba1e8 100644 --- a/home-manager/progs/gpt4all/gpt4all.nix +++ b/home-manager/progs/gpt4all/gpt4all.nix @@ -6,11 +6,12 @@ }: let models = [ - { - name = "DeepSeek-R1-Distill-Qwen-14B-Q4_0.gguf"; + rec { + name = "DeepSeek-R1-Distill-Qwen-14B-Q4_0"; + filename = builtins.elemAt (lib.splitString "?" src.name) 0; context_length = 32768; gen_length = 8192; - source = pkgs.fetchurl { + src = pkgs.fetchurl { url = "https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-14B-GGUF/resolve/main/DeepSeek-R1-Distill-Qwen-14B-Q4_0.gguf?download=true"; sha256 = "906b3382f2680f4ce845459b4a122e904002b075238080307586bcffcde49eef"; }; @@ -32,6 +33,8 @@ let "-mtune=native" ] ); + + system_prompt = ""; in { home.packages = [ @@ -42,9 +45,6 @@ in lib.recursiveUpdate { ".config/nomic.ai/GPT4All.ini".text = - let - system_prompt = ""; - in '' [General] chatTheme=Dark @@ -63,20 +63,19 @@ in [download] lastVersionStarted=${gpt4all_package.version} '' - + (lib.concatStrings ( - map (model: '' - [model-${model.name}] - contextLength=${builtins.toString model.context_length} - filename=${model.name} - maxLength=${builtins.toString model.gen_length} - promptBatchSize=256 - systemMessage="${ - # replace newlines with the string "\n" for gpt4all to properly parse - builtins.replaceStrings [ "\n" ] [ "\\n" ] system_prompt - }\n" - '') models - )) + + (lib.concatMapStringsSep "\n" (model: '' + [model-${model.name}] + contextLength=${builtins.toString model.context_length} + filename=${model.filename} + maxLength=${builtins.toString model.gen_length} + promptBatchSize=256 + systemMessage="${ + # replace newlines with the string "\n" for gpt4all to properly parse + builtins.replaceStrings [ "\n" ] [ "\\n" ] system_prompt + }" + '') models) + '' + \n [network] isActive=true usageStatsActive=true @@ -85,8 +84,8 @@ in ( builtins.listToAttrs ( map (f: { - name = ".local/share/nomic.ai/GPT4All/${f.name}"; - value.source = f.source; + name = ".local/share/nomic.ai/GPT4All/${f.filename}"; + value.source = f.src; }) models ) );