From 8f62957886dd604e78d8d85bb6a978fe70a0ac5b Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 11 Apr 2025 07:37:15 -0500 Subject: [PATCH] build --- flake.nix | 111 ++++++++++++++++++++++++---------- modules/Ollama/src/Ollama.cpp | 5 +- modules/Ollama/src/Ollama.h | 7 +++ 3 files changed, 87 insertions(+), 36 deletions(-) diff --git a/flake.nix b/flake.nix index 100b881..87dd826 100755 --- a/flake.nix +++ b/flake.nix @@ -62,46 +62,45 @@ ImguiModule = pkgs.stdenvNoCC.mkDerivation { - name = "ImguiModule"; + name = "ImguiModule"; - src = ./.; + src = ./.; - imgui = inputs.imgui; + imgui = inputs.imgui; - nativeBuildInputs = with pkgs; [ - clang - ]; + nativeBuildInputs = with pkgs; [ + clang + ]; - buildInputs = with pkgs; [ - glfw - glew - ]; + buildInputs = with pkgs; [ + glfw + glew + ]; - buildPhase = '' - clang++ \ - modules/ImguiModule/src/*.cpp \ - modules/WindowModule/src/*.cpp \ - $imgui/backends/imgui_impl_glfw.cpp \ - $imgui/backends/imgui_impl_opengl3.cpp \ - $imgui/misc/cpp/*.cpp \ - $imgui/*.cpp \ - -DRENDERER_OPENGL \ - -DWINDOW_GLFW \ - -DIMGUIMODULE_DYNAMIC \ - -fpic -shared \ - -I src -I include -I $imgui -I . \ - -lGL -lglfw -lGLEW \ - -Wall \ - -o $name - ''; + buildPhase = '' + clang++ \ + modules/ImguiModule/src/*.cpp \ + modules/WindowModule/src/*.cpp \ + $imgui/backends/imgui_impl_glfw.cpp \ + $imgui/backends/imgui_impl_opengl3.cpp \ + $imgui/misc/cpp/*.cpp \ + $imgui/*.cpp \ + -DRENDERER_OPENGL \ + -DWINDOW_GLFW \ + -DIMGUIMODULE_DYNAMIC \ + -fpic -shared \ + -I src -I include -I $imgui -I . \ + -lGL -lglfw -lGLEW \ + -Wall \ + -o $name + ''; - installPhase = '' - mkdir -p $out/bin - cp $name $out/bin - ''; - - }; + installPhase = '' + mkdir -p $out/bin + cp $name $out/bin + ''; + }; MainGUI = pkgs.stdenvNoCC.mkDerivation { @@ -145,6 +144,52 @@ ''; }; + + Ollama = pkgs.stdenvNoCC.mkDerivation { + + name = "Ollama"; + + src = ./.; + + inherit imgui; + + nativeBuildInputs = with pkgs; [ + clang + ]; + + buildInputs = with pkgs; [ + glfw + glew + + curl + nlohmann_json + ]; + + buildPhase = '' + clang++ \ + modules/Ollama/src/*.cpp \ + modules/ImguiModule/src/*.cpp \ + modules/WindowModule/src/*.cpp \ + $imgui/backends/imgui_impl_glfw.cpp \ + $imgui/backends/imgui_impl_opengl3.cpp \ + $imgui/misc/cpp/*.cpp \ + $imgui/*.cpp \ + -DRENDERER_OPENGL \ + -DWINDOW_GLFW \ + -DMAINGUI_DYNAMIC \ + -fpic -shared \ + -I src -I include -I $imgui -I . \ + -lGL -lglfw -lGLEW \ + -Wall \ + -o $name + ''; + + installPhase = '' + mkdir -p $out/bin + cp $name $out/bin + ''; + + }; }; diff --git a/modules/Ollama/src/Ollama.cpp b/modules/Ollama/src/Ollama.cpp index 7a3d011..dccf092 100644 --- a/modules/Ollama/src/Ollama.cpp +++ b/modules/Ollama/src/Ollama.cpp @@ -1,9 +1,6 @@ #include "Ollama.h" #include "modules/ImguiModule/src/ImguiModule.h" -#include -#include - Ollama::Ollama(Archimedes::App* a, void* h) : Archimedes::Module(a, h) { name = "Ollama"; @@ -27,6 +24,8 @@ void Ollama::onLoad() { ImGui::SetCurrentContext(im->getContext()); + curl = curl_easy_init(); + } void Ollama::run() { diff --git a/modules/Ollama/src/Ollama.h b/modules/Ollama/src/Ollama.h index 478c484..f32ae25 100644 --- a/modules/Ollama/src/Ollama.h +++ b/modules/Ollama/src/Ollama.h @@ -1,5 +1,8 @@ #include "Archimedes.h" +#include +#include + class Ollama : public Archimedes::Module { public: @@ -10,6 +13,10 @@ class Ollama : public Archimedes::Module { void onLoad(); void run(); + + private: + CURL* curl; + }; #ifdef OLLAMA_DYNAMIC