diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/build.sh b/build.sh index c36d069..1655f44 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,12 @@ -#!/usr/bin/bash +#!/usr/bin/env bash echo "Running CMake" -cmake --preset=default +if grep 'NAME=NixOS' /etc/os-release +then + cmake --preset nixos +else + cmake --preset linux +fi echo "Running Ninja" if echo "$@" | grep -e "clean" -q diff --git a/compile_commands.json b/compile_commands.json new file mode 120000 index 0000000..25eb4b2 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1 @@ +build/compile_commands.json \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d1752e5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1738734093, + "narHash": "sha256-UEYOKfXXKU49fR7dGB05As0s2pGbLK4xDo48Qtdm7xs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5b2753b0356d1c951d7a3ef1d086ba5a71fff43c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e63c4c3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,55 @@ +{ + 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: + let + pkgs = import nixpkgs { + inherit system; + }; + eabase = pkgs.callPackage ./vendored-nix/eabase {}; + eastl = pkgs.callPackage ./vendored-nix/eastl { inherit eabase; }; + tinygltf = pkgs.callPackage ./vendored-nix/tinygltf {}; + debugbreak = pkgs.callPackage ./vendored-nix/scottt-debugbreak {}; + in + with pkgs; + { + devShells.default = clangStdenv.mkDerivation { + name = "BlazeEnv"; + + + nativeBuildInputs = [ + cmake + ninja + ccls + (imgui.override {IMGUI_BUILD_VULKAN_BINDING = true; IMGUI_BUILD_GLFW_BINDING=true; }) + ]; + + buildInputs = [ + sdl3 + glm + glfw3 + eastl + fmt + eabase + eastl + entt + tinygltf + debugbreak + stb + + # vulkan + vulkan-headers + vulkan-loader + vulkan-validation-layers + vulkan-memory-allocator + directx-shader-compiler + glslang + shaderc + ]; + }; + } + ); +} diff --git a/run.sh b/run.sh index 2bcadf8..da66291 100755 --- a/run.sh +++ b/run.sh @@ -10,5 +10,5 @@ if [ -d "build" ]; then fi popd > /dev/null || exit else - echo "Build blaze first." + echo "Build Aster first." fi