{ description = "Build Project Archimedes"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; imgui = { url = "github:ocornut/imgui?ref=docking"; flake = false; }; clay = { url = "github:nicbarker/clay"; flake = false; }; }; outputs = { self, nixpkgs, imgui, clay }@inputs: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; in { Archimedes = { examples = import ./ExampleApps.nix { inherit inputs; inherit pkgs; }; }; Modules = { examples = import ./ExampleModules.nix { inherit inputs; inherit pkgs; }; ServerModule = pkgs.stdenvNoCC.mkDerivation { name = "ServerModule"; src = ./.; nativeBuildInputs = with pkgs; [ clang ]; buildInputs = with pkgs; [ gamenetworkingsockets ]; buildPhase = '' clang++ \ modules/ServerModule/src/*.cpp \ -fpic -shared \ -I src -I include \ -I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \ -lGameNetworkingSockets \ -DSERVERMODULE_DYNAMIC \ -Wall \ -o $name ''; installPhase = '' mkdir -p $out/bin cp $name $out/bin ''; }; ClientModule = pkgs.stdenvNoCC.mkDerivation { name = "ClientModule"; src = ./.; nativeBuildInputs = with pkgs; [ clang ]; buildInputs = with pkgs; [ gamenetworkingsockets ]; buildPhase = '' clang++ \ modules/ClientModule/src/*.cpp \ -fpic -shared \ -I src -I include \ -I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \ -lGameNetworkingSockets \ -DCLIENTMODULE_DYNAMIC \ -Wall \ -o $name ''; installPhase = '' mkdir -p $out/bin cp $name $out/bin ''; }; WindowModule = pkgs.stdenvNoCC.mkDerivation { name = "WindowModule"; src = ./.; nativeBuildInputs = with pkgs; [ clang ]; buildInputs = with pkgs; [ glfw glew ]; buildPhase = '' clang++ \ modules/WindowModule/src/*.cpp \ -fpic -shared \ -I src -I include \ -DRENDERER_OPENGL \ -DWINDOW_GLFW \ -DWINDOWMODULE_DYNAMIC \ -lGL -lglfw -lGLEW \ -Wall \ -o $name ''; installPhase = '' mkdir -p $out/bin cp $name $out/bin ''; }; ImguiModule = pkgs.stdenvNoCC.mkDerivation { name = "ImguiModule"; src = ./.; imgui = inputs.imgui; nativeBuildInputs = with pkgs; [ clang ]; 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 \ -DCUSTOMFONT=${pkgs.fira-code}/share/fonts/truetype/FiraCode-VF.ttf \ -fpic -shared \ -I src -I include -I $imgui -I . \ -lGL -lglfw -lGLEW \ -Wall \ -o $name ''; installPhase = '' mkdir -p $out/bin cp $name $out/bin ''; }; MainGUI = pkgs.stdenvNoCC.mkDerivation { name = "MainGUI"; src = ./.; inherit imgui; nativeBuildInputs = with pkgs; [ clang ]; buildInputs = with pkgs; [ glfw glew ]; buildPhase = '' clang++ \ modules/MainGUI/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 ''; }; Terminal = pkgs.stdenvNoCC.mkDerivation { name = "Terminal"; src = ./.; inherit imgui; nativeBuildInputs = with pkgs; [ clang ]; buildInputs = with pkgs; [ glfw glew ]; buildPhase = '' clang++ \ modules/Terminal/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 \ -DTERMINAL_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 ''; }; 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 \ -DOLLAMA_DYNAMIC \ -fpic -shared \ -I src -I include -I $imgui -I . \ -lGL -lglfw -lGLEW \ $(curl-config --cflags) \ $(curl-config --libs) \ -Wall \ -o $name ''; installPhase = '' mkdir -p $out/bin cp $name $out/bin ''; }; }; packages.${system}.default = self.Archimedes; apps.${system}.default = { type = "app"; program = "${self.Archimedes.examples.MinimalApp}/bin/Archimedes"; }; }; }