Files
Archimedes/flake.nix
2025-04-01 01:00:57 -05:00

102 lines
2.4 KiB
Nix
Executable File

{
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; };
WindowModule = pkgs.stdenvNoCC.mkDerivation {
name = "WindowModule";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
modules/Window/src/*.cpp \
-fpic -shared \
-I src -I include \
-DRENDERER_OPENGL \
-DWINDOW_GLFW \
-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
];
buildPhase = ''
clang++ \
modules/MainGUI/src/*.cpp \
-fpic -shared \
-I src -I include \
-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";
};
};
}