flake parts

This commit is contained in:
2026-02-14 16:24:35 -06:00
parent 874de65dba
commit f01bd49fb1
12 changed files with 296 additions and 373 deletions

View File

@@ -1,89 +0,0 @@
{ inputs, pkgs, ... }: {
TriangleEmbed = pkgs.stdenvNoCC.mkDerivation {
name = "Archimedes";
src = ./.;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
glm
nlohmann_json
curl
];
buildPhase = ''
clang++ \
src/example_apps/TriangleEmbed/*.cpp \
modules/Archimedes-Modules/TestTriangle/*.cpp \
modules/WindowModule/*.cpp \
-DRENDERER_OPENGL=1 \
-DWINDOW_GLFW=1 \
-I include -I . \
-lEGL -lGL -lglfw -lGLEW \
$(curl-config --cflags) \
$(curl-config --libs) \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
TerminalEmbed = pkgs.stdenvNoCC.mkDerivation {
name = "Archimedes";
src = ./.;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
src/example_apps/TerminalEmbed/*.cpp \
modules/Archimedes-Modules/Terminal/*.cpp \
modules/WindowModule/*.cpp \
modules/ImguiModule/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=1 \
-I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
}

View File

@@ -1,6 +1,17 @@
{ inputs, ... }: {
{ self, inputs, ... }: {
flake.overlays.glfw-old = (final: prev: let
pkgs-old = import inputs.nixpkgs-old { system = prev.stdenv.hostPlatform.system; };
in { glfw = pkgs-old.glfw; });
perSystem = { lib, system, pkgs, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
self.overlays.glfw-old
];
config = {};
};
};
}

248
flake.nix
View File

@@ -21,252 +21,8 @@
outputs = { self, flake-parts, import-tree, ... } @ inputs:
flake-parts.lib.mkFlake {
inputs = inputs // {
src = ./.;
src = ./src;
};
} (import-tree [ ./modules ./src ./dev ]);
} (import-tree [ ./src ./dev ]);
/*
Modules = {
examples = import ./ExampleModules.nix { inherit inputs pkgs; };
ServerModule = pkgs.stdenvNoCC.mkDerivation {
name = "ServerModule";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
];
buildPhase = ''
clang++ \
modules/ServerModule/*.cpp \
-fpic -shared \
-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/*.cpp \
-fpic -shared \
-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/*.cpp \
-fpic -shared \
-I include \
-DRENDERER=1 \
-DWINDOW=1 \
-DWINDOWMODULE_DYNAMIC \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
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/*.cpp \
modules/WindowModule/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=1 \
-DIMGUIMODULE_DYNAMIC \
-DCUSTOMFONT=${pkgs.fira-code}/share/fonts/truetype/FiraCode-VF.ttf \
-fpic -shared \
-I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
MainGUIsdl = pkgs.stdenvNoCC.mkDerivation {
name = "MainGUI";
src = ./.;
inherit imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
sdl3
];
buildPhase = ''
clang++ \
modules/MainGUI/*.cpp \
modules/ImguiModule/*.cpp \
modules/WindowModule/*.cpp \
$imgui/backends/imgui_impl_sdl3.cpp \
$imgui/backends/imgui_impl_sdlrenderer3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=2 \
-DWINDOW=2 \
-DMAINGUI_DYNAMIC \
-fpic -shared \
-I include -I $imgui -I . \
-lSDL3 \
-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/*.cpp \
modules/ImguiModule/*.cpp \
modules/WindowModule/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=1 \
-DMAINGUI_DYNAMIC \
-fpic -shared \
-I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
};
packages.${system}.default = self.Archimedes.examples.MinimalApp;
apps.${system}.default = {
type = "app";
program = "${self.Archimedes.examples.MinimalApp}/bin/Archimedes";
};
*/
}

View File

@@ -1,6 +1,8 @@
{ inputs, ... }: {
perSystem = { system, pkgs, self', ... }: {
perSystem = { lib, system, pkgs, ... }: {
packages.exampleApps_ImguiEmbed = pkgs.stdenvNoCC.mkDerivation {
name = "Archimedes";
@@ -24,7 +26,7 @@
buildPhase = ''
clang++ \
$src/src/example_apps/ImguiEmbed/*.cpp \
$src/example_apps/ImguiEmbed/*.cpp \
$src/modules/MainGUI/*.cpp \
$src/modules/WindowModule/*.cpp \
$src/modules/ImguiModule/*.cpp \

View File

@@ -16,7 +16,7 @@
buildPhase = ''
clang++ \
$src/src/example_apps/MinimalApp/MinimalApp.cpp \
$src/example_apps/MinimalApp/MinimalApp.cpp \
-I $src/include \
-Wall \
-o $name

View File

@@ -2,37 +2,47 @@
perSystem = { system, pkgs, self', ... }: {
packages.exampleApps_MinimalApp = pkgs.stdenvNoCC.mkDerivation {
packages.exampleApps_TerminalEmbed = pkgs.stdenvNoCC.mkDerivation {
name = "Archimedes";
src = inputs.src;
outputs = [ "out" "dev" ];
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
$src/src/example_apps/MinimalApp/MinimalApp.cpp \
-I $src/include \
example_apps/TerminalEmbed/*.cpp \
modules/Archimedes-Modules/Terminal/*.cpp \
modules/WindowModule/*.cpp \
modules/ImguiModule/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=1 \
-I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
mkdir -p $dev/include/modules
cp -r include/* $dev/include
cp -r modules $dev/include/modules
'';
};
};
}

View File

@@ -2,37 +2,48 @@
perSystem = { system, pkgs, self', ... }: {
packages.exampleApps_MinimalApp = pkgs.stdenvNoCC.mkDerivation {
packages.exampleApps_TriangleEmbed = pkgs.stdenvNoCC.mkDerivation {
name = "Archimedes";
name = "Archimedes";
src = inputs.src;
src = inputs.src;
outputs = [ "out" "dev" ];
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
nativeBuildInputs = with pkgs; [
clang
];
buildPhase = ''
clang++ \
$src/src/example_apps/MinimalApp/MinimalApp.cpp \
-I $src/include \
-Wall \
-o $name
'';
buildInputs = with pkgs; [
glfw
glew
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
glm
nlohmann_json
curl
];
mkdir -p $dev/include/modules
cp -r include/* $dev/include
cp -r modules $dev/include/modules
'';
buildPhase = ''
clang++ \
src/example_apps/TriangleEmbed/*.cpp \
modules/Archimedes-Modules/TestTriangle/*.cpp \
modules/WindowModule/*.cpp \
-DRENDERER_OPENGL=1 \
-DWINDOW_GLFW=1 \
-I include -I . \
-lEGL -lGL -lglfw -lGLEW \
$(curl-config --cflags) \
$(curl-config --libs) \
-Wall \
-o $name
'';
};
};
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
}; };
}

View File

@@ -0,0 +1,40 @@
{ ... }: {
perSystem = { system, pkgs, self', ... }: {
packages.ClientModule = pkgs.stdenvNoCC.mkDerivation {
name = "ClientModule";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
];
buildPhase = ''
clang++ \
modules/ClientModule/*.cpp \
-fpic -shared \
-I include \
-I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \
-lGameNetworkingSockets \
-DCLIENTMODULE_DYNAMIC \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
};
}

View File

@@ -0,0 +1,50 @@
{ inputs, ... }: {
perSystem = { system, pkgs, self', ... }: {
packages.ImguiModule = pkgs.stdenvNoCC.mkDerivation {
name = "ImguiModule";
src = ./.;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
modules/ImguiModule/*.cpp \
modules/WindowModule/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=1 \
-DIMGUIMODULE_DYNAMIC \
-DCUSTOMFONT=${pkgs.fira-code}/share/fonts/truetype/FiraCode-VF.ttf \
-fpic -shared \
-I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
};
}

View File

@@ -0,0 +1,50 @@
{ inputs, ... }: {
perSystem = { system, pkgs, self', ... }: {
packages.MainGUI = pkgs.stdenvNoCC.mkDerivation {
name = "MainGUI";
src = inputs.src;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
modules/MainGUI/*.cpp \
modules/ImguiModule/*.cpp \
modules/WindowModule/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=1 \
-DMAINGUI_DYNAMIC \
-fpic -shared \
-I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
};
}

View File

@@ -0,0 +1,40 @@
{ ... }: {
perSystem = { system, pkgs, self', ... }: {
packages.ServerModule = pkgs.stdenvNoCC.mkDerivation {
name = "ServerModule";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
];
buildPhase = ''
clang++ \
modules/ServerModule/*.cpp \
-fpic -shared \
-I include \
-I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \
-lGameNetworkingSockets \
-DSERVERMODULE_DYNAMIC \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
};
}

View File

@@ -0,0 +1,42 @@
{ ... }: {
perSystem = { system, pkgs, self', ... }: {
packages.WindowModule = pkgs.stdenvNoCC.mkDerivation {
name = "WindowModule";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
modules/WindowModule/*.cpp \
-fpic -shared \
-I include \
-DRENDERER=1 \
-DWINDOW=1 \
-DWINDOWMODULE_DYNAMIC \
-lGL -lglfw -lGLEW \
-Wall \
-o $name -DIMGUI_IMPL_GLFW_DISABLE_X11
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
};
}