From 52dac7a94f0a0199284f20ca8e7cce41fc97ac33 Mon Sep 17 00:00:00 2001 From: VOXEL <111713723+VOXEL0798@users.noreply.github.com> Date: Wed, 6 Aug 2025 04:22:04 +0300 Subject: [PATCH] Update flake.nix --- flake.nix | 69 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 2c392d27..bc9ead2b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,16 +1,69 @@ { + description = "VoxelCore – voxel game engine in C++"; + inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: { - devShells.default = with nixpkgs.legacyPackages.${system}; mkShell { - nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ glm glfw glew zlib libpng libvorbis openal luajit curl ]; # libglvnd - packages = [ glfw mesa freeglut entt ]; - LD_LIBRARY_PATH = "${wayland}/lib:$LD_LIBRARY_PATH"; + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + voxel-core = pkgs.stdenv.mkDerivation { + name = "voxel-core"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + cmake + pkg-config + ]; + + buildInputs = with pkgs; [ + glm + glfw + glew + zlib + libpng + libvorbis + openal + luajit + curl + entt + mesa + freeglut + ]; # libglvnd + + packages = with pkgs; [ + glfw + mesa + freeglut + entt + ]; + cmakeFlags = [ + "-DCMAKE_PREFIX_PATH=${pkgs.entt}" + "-DCMAKE_INCLUDE_PATH=${pkgs.entt}/include" + ]; + + installPhase = '' + mkdir -p $out/bin + cp VoxelEngine $out/bin/ + ''; }; - }); + in + { + packages.default = voxel-core; + apps.default = { + type = "app"; + program = "${voxel-core}/bin/VoxelCore"; + }; + } + ); }