Tweaked the package
Some checks failed
Build VulkanEngine / build (push) Has been cancelled

This commit is contained in:
Alexandre 2026-09-30 22:57:26 +02:00
parent 69492d78ac
commit 6ab1795eeb

View File

@ -1,6 +1,7 @@
{ lib { lib
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, fetchgit
, cmake , cmake
, ninja , ninja
, pkg-config , pkg-config
@ -8,6 +9,7 @@
, glm , glm
, vulkan-headers , vulkan-headers
, vulkan-loader , vulkan-loader
, vulkan-utility-libraries
, vulkan-memory-allocator , vulkan-memory-allocator
, vk-bootstrap , vk-bootstrap
, fmt , fmt
@ -18,30 +20,37 @@
}: }:
let let
fs = lib.fileset;
fastgltf = fetchFromGitHub { fastgltf = fetchFromGitHub {
owner = "spnda"; owner = "spnda";
repo = "fastgltf"; repo = "fastgltf";
rev = "v0.8.0"; rev = "v0.8.0";
hash = "sha256-nPkVMrve1+04XRpSswBqjlSurliCFBRxR8Zxy4xZ5pE="; hash = "sha256-nPkVMrve1+04XRpSswBqjlSurliCFBRxR8Zxy4xZ5pE=";
}; };
imgui = fetchgit {
url = "https://git.alexdelcamp.fr/Alexandre_1a/imgui.git";
rev = "d7cce3ad5070bbdbbd7a39335c0c1e90071211d0";
hash = "sha256-2v085YFc17aj96YlOc4Fp8sJUHUmjRU8X54FnuqKrgc=";
};
in in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "vulkan-engine"; pname = "vulkan-engine";
version = "0.1.0"; version = "0.1.0";
src = builtins.path { src = ./.;
path = ./.;
name = "vulkan-engine-source"; postUnpack = ''
filter = path: type: # include/ peut ne pas exister du tout dans la copie flake
let base = baseNameOf path; # (cas de figure ici), donc on le crée.
in !(builtins.elem base [ mkdir -p $sourceRoot/include
".git"
".direnv" # On remplace les dossiers vides (ou absents) par les vraies sources
"build" rm -rf $sourceRoot/include/imgui $sourceRoot/include/CLI11
"result" cp -r ${imgui} $sourceRoot/include/imgui
"result-bundle"
"_deps" # Autorise le write sur l'arbre : CMake va générer des fichiers
]); chmod -R u+w $sourceRoot
}; '';
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
@ -56,6 +65,7 @@ stdenv.mkDerivation {
glm glm
vulkan-headers vulkan-headers
vulkan-loader vulkan-loader
vulkan-utility-libraries
vk-bootstrap vk-bootstrap
vulkan-memory-allocator vulkan-memory-allocator
fmt fmt
@ -72,12 +82,29 @@ stdenv.mkDerivation {
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
cp build/engine/engine $out/bin/engine
cp build/server/server $out/bin/server # Les binaires sont relatifs au répertoire de build (cwd = $sourceRoot/build)
if [ -d build/engine/shaders ]; then cp engine/engine $out/bin/engine
cp -r build/engine/shaders $out/bin/shaders cp server/server $out/bin/server
# Shaders compilés (glslang/slang) — générés dans engine/shaders
if [ -d engine/shaders ]; then
cp -r engine/shaders $out/bin/shaders
fi fi
# Assets copiés par addBinary() : modèles et textures
if [ -d engine/models ]; then
cp -r engine/models $out/bin/models
fi
if [ -d engine/textures ]; then
cp -r engine/textures $out/bin/textures
fi
# Fichiers annexes produits au runtime / par addBinary
[ -f engine/LICENSE ] && cp engine/LICENSE $out/bin/LICENSE
runHook postInstall runHook postInstall
''; '';