gpt4all more config stuff

This commit is contained in:
Simon Gardling 2024-09-20 10:29:35 -04:00
parent b26a8b9d10
commit b45a145f98
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
5 changed files with 149 additions and 104 deletions

View File

@ -332,11 +332,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726798147, "lastModified": 1726830936,
"narHash": "sha256-k/Ojv+MUDKUbj8JPd1MulJrf5BVz3jIUfrreMHbeTBE=", "narHash": "sha256-ARM4KG4uxsHfONxyT4kSmcPpZuWsnrxDvTgxuzT31XI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e88358265511d3a73b30dc6e4c15579844b35280", "rev": "039db25806f936e6a4ad3ab3efd0689a8cc7c23e",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -127,11 +127,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1726785354, "lastModified": 1726823634,
"narHash": "sha256-SLorVhoorZwjM1aS04bBX4fufEXIfkMdAGkj9bu2QAQ=", "narHash": "sha256-rU8Yy62KSLU8Q2J64F+50OJKORNdogxbXl2w4rFw13o=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1786e2afdbc48e9038f7cff585069736e1d0ed44", "rev": "4803bf558bdf20cb067aceb8830b7ad70113f4e3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -201,11 +201,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726798147, "lastModified": 1726836432,
"narHash": "sha256-k/Ojv+MUDKUbj8JPd1MulJrf5BVz3jIUfrreMHbeTBE=", "narHash": "sha256-fk9P0RY2m7r3vAqqSRaR/MZoQJo6yg6vuv4h7D1I2/8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e88358265511d3a73b30dc6e4c15579844b35280", "rev": "b3e9ef326d3d60dd97c262c6d16cc255175d4902",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -281,11 +281,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1726712837, "lastModified": 1726799228,
"narHash": "sha256-Ob7DNyHKtOQpWetmNj/V+OgMkGXh6Ep1dNa6AN/4sSI=", "narHash": "sha256-wn1leQyMAc/TrLRKcPc0GX6YtoziKQpc/MtZjPNiJ2Q=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "6283b1d6ca31fa320ecee82806123e773b2ff993", "rev": "ab150c7412db7bea5879ce2776718f53fba37aa2",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -8,6 +8,7 @@
imports = [ imports = [
./no-gui.nix ./no-gui.nix
# ./progs/librewolf.nix # ./progs/librewolf.nix
./progs/gpt4all.nix
]; ];
nixpkgs.config.allowUnfreePredicate = nixpkgs.config.allowUnfreePredicate =
@ -17,120 +18,82 @@
"factorio-alpha" "factorio-alpha"
]; ];
home.packages = home.packages = with pkgs; [
let #calculator
#stolen from: https://stackoverflow.com/a/42398526 gnome-calculator
optimizeWithFlags =
pkg: flags:
pkgs.lib.overrideDerivation pkg (
old:
let
newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags;
oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else "";
in
{
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
stdenv = pkgs.clangStdenv;
}
);
in
with pkgs;
[
#calculator
gnome-calculator
#productivity stuff #productivity stuff
libreoffice libreoffice
hunspell # spellcheck hunspell # spellcheck
hunspellDicts.en_US # spellcheck dictionary hunspellDicts.en_US # spellcheck dictionary
#video and audio downloading #video and audio downloading
parabolic parabolic
#soulseek client #soulseek client
nicotine-plus nicotine-plus
#dark web browsing deep web browsing #dark web browsing deep web browsing
tor-browser tor-browser
#audio editing #audio editing
audacity audacity
#fonts #fonts
noto-fonts noto-fonts
noto-fonts-emoji noto-fonts-emoji
liberation_ttf liberation_ttf
nerdfonts nerdfonts
jetbrains-mono jetbrains-mono
#for ebook reading #for ebook reading
foliate foliate
#audio mixer (pavucontrol but for pipewire) #audio mixer (pavucontrol but for pipewire)
pwvucontrol pwvucontrol
#minecraft launcher #minecraft launcher
prismlauncher prismlauncher
mpv mpv
mumble mumble
system76-keyboard-configurator system76-keyboard-configurator
mission-center mission-center
#jellyfin #jellyfin
finamp # music player finamp # music player
delfin # jellyfin client delfin # jellyfin client
signal-desktop signal-desktop
#accounting #accounting
gnucash gnucash
imagemagick imagemagick
inkscape inkscape
nomacs nomacs
nautilus nautilus
lrcget lrcget
#openstreetmap contributing #openstreetmap contributing
josm josm
gparted gparted
gnome-disk-utility gnome-disk-utility
#small nicities #small nicities
wl-clipboard # wl-copy & wl-paste wl-clipboard # wl-copy & wl-paste
libnotify # notifications library libnotify # notifications library
xdg-utils # xdg utils xdg-utils # xdg utils
puddletag puddletag
inputs.zen-browser.packages."${pkgs.system}".specific inputs.zen-browser.packages."${pkgs.system}".specific
(factorio.override (import ./secrets/factorio.nix)) (factorio.override (import ./secrets/factorio.nix))
];
(optimizeWithFlags
(gpt4all.overrideAttrs {
src = fetchFromGitHub {
fetchSubmodules = true;
owner = "nomic-ai";
repo = "gpt4all";
rev = "HEAD";
sha256 = "lGvxTOBg7/UgrCqeAFNFFXD9VjpUk3IVCktdUYuF6Eo=";
};
patches = [ ./gpt4all-HEAD-embeddings-model.patch ];
})
[
"-Ofast"
"-march=native"
"-mtune=native"
"-fno-protect-parens"
"-fno-finite-math-only" # https://github.com/ggerganov/llama.cpp/pull/7154#issuecomment-2143844461
]
)
];
# make chromium-based stuff use wayland # make chromium-based stuff use wayland
home.file.".config/chromium-flags.conf".text = "--ozone-platform-hint=auto"; home.file.".config/chromium-flags.conf".text = "--ozone-platform-hint=auto";

View File

@ -0,0 +1,82 @@
{ pkgs, ... }:
{
home.packages =
let
#stolen from: https://stackoverflow.com/a/42398526
optimizeWithFlags =
pkg: flags:
pkgs.lib.overrideDerivation pkg (
old:
let
newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags;
oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else "";
in
{
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
stdenv = pkgs.clangStdenv;
}
);
in
with pkgs;
[
(optimizeWithFlags
(gpt4all.overrideAttrs {
src = fetchFromGitHub {
fetchSubmodules = true;
owner = "nomic-ai";
repo = "gpt4all";
rev = "HEAD";
sha256 = "lGvxTOBg7/UgrCqeAFNFFXD9VjpUk3IVCktdUYuF6Eo=";
};
patches = [ ./gpt4all-HEAD-embeddings-model.patch ];
})
[
"-Ofast"
"-march=native"
"-mtune=native"
"-fno-protect-parens"
"-fno-finite-math-only" # https://github.com/ggerganov/llama.cpp/pull/7154#issuecomment-2143844461
]
)
];
home.file.".config/nomic.ai/GPT4All.ini" = {
text =
let
system_prompt = "You are an expert AI assistant that explains your reasoning step by step. For each step, provide a title that describes what you're doing in that step, along with the content. Decide if you need another step or if you're ready to give the final answer. USE AS MANY REASONING STEPS AS POSSIBLE. AT LEAST 3. BE AWARE OF YOUR LIMITATIONS AS AN LLM AND WHAT YOU CAN AND CANNOT DO. EXPLORE ALTERNATE ANSWERS AND CONSIDER THAT YOUR ANSWER MAY BE WRONG. IDENTIFY POSSIBLE ERRORS IN YOUR REASONING AND WHERE SUCH ERRORS MAY BE. FULLY TEST ALL OTHER POSSIBILITIES. YOU CAN BE WRONG. WHEN YOU SAY YOU ARE RE-EXAMINING, ACTUALLY RE-EXAMINE, AND USE ANOTHER APPROACH TO DO SO. DO NOT JUST SAY YOU ARE RE-EXAMINING. SHOW ALL YOUR WORK. USE AT LEAST 3 METHODS TO DERIVE THE ANSWER. USE BEST PRACTICES. WORK FROM FIRST PRINCIPLES TO CREATE YOUR ANSWER.";
in
''
[General]
chatTheme=Dark
height=940
suggestionMode=Off
threadCount=8
uniqueId=7096f2d2-448d-4272-a132-d37e77f8a781
userDefaultModel=Qwen2.5-7B-Instruct-Q6_K_L.gguf
width=1472
x=0
y=0
[download]
lastVersionStarted=3.3.0-dev0
[model-Qwen2.5-7B-Instruct-Q6_K_L.gguf]
contextLength=32768
filename=Qwen2.5-7B-Instruct-Q6_K_L.gguf
maxLength=32768
promptBatchSize=512
promptTemplate=<|im_start|>user\n%1<|im_end|>\n<|im_start|>assistant\n
systemPrompt="<|im_start|>system\n${system_prompt}<|im_end|>"
[network]
isActive=true
usageStatsActive=true
'';
};
home.file.".local/share/nomic.ai/GPT4All/Qwen2.5-7B-Instruct-Q6_K_L.gguf" = {
source = pkgs.fetchurl {
url = "https://huggingface.co/bartowski/Qwen2.5-7B-Instruct-GGUF/resolve/main/Qwen2.5-7B-Instruct-Q6_K_L.gguf?download=true";
sha256 = "thEXN06T/UVGfzdB83jlgpG7kuTzZtz1ZUAdupAnErM=";
};
};
}