commit 4443acb493155e3bc11ab5e02d140ee8aff69a64 Author: Warwick Date: Wed Apr 16 10:35:11 2025 +0100 Initial commit with nix packages setup diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4dd49cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +CMakeCache.txt +CMakeFiles/ +Makefile +cmake_install.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a72f9d7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.31) +project(ProjectName) +include(FeatureSummary) + +# Use environment set by nix-shell to find wgpu include and library +find_path(WGPU_INCLUDE wgpu) +find_library(WGPU_LIBRARY libwgpu_native.so) +message(STATUS "wgpu lib: ${WGPU_LIBRARY}") +message(STATUS "wgpu include dir: ${WGPU_INCLUDE}") + +find_package(SDL3 REQUIRED) +find_package(SDL3_image REQUIRED) +find_package(cglm REQUIRED) + +feature_summary(WHAT PACKAGES_FOUND) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..019392c --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1744463964, + "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..eed5e8e --- /dev/null +++ b/flake.nix @@ -0,0 +1,15 @@ +{ + description = "Development Environment"; + + inputs = { + nixpkgs.url= "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = {self, nixpkgs, ...}: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + devShells.x86_64-linux.default = (import ./shell.nix { inherit pkgs; }); + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..452856f --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +{ pkgs ? import {} }: + +pkgs.mkShell +{ + nativeBuildInputs = with pkgs; [ + cmake + wgpu-native + cglm + sdl3 + sdl3-image + ]; + shellHook = '' + export PS1="(webgpu) $PS1" + ''; +}