Initial commit with nix packages setup

This commit is contained in:
Warwick 2025-04-16 10:35:11 +01:00
commit 4443acb493
5 changed files with 76 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
CMakeCache.txt
CMakeFiles/
Makefile
cmake_install.cmake

15
CMakeLists.txt Normal file
View file

@ -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)

27
flake.lock Normal file
View file

@ -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
}

15
flake.nix Normal file
View file

@ -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; });
};
}

15
shell.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell
{
nativeBuildInputs = with pkgs; [
cmake
wgpu-native
cglm
sdl3
sdl3-image
];
shellHook = ''
export PS1="(webgpu) $PS1"
'';
}