1{ lib, stdenv, fetchFromGitHub, cmake }: 2 3let 4 basis_universal = fetchFromGitHub { 5 owner = "zeux"; 6 repo = "basis_universal"; 7 rev = "8903f6d69849fd782b72a551a4dd04a264434e20"; 8 hash = "sha256-o3dCxAAkpMoNkvkM7qD75cPn/obDc/fJ8u7KLPm1G6g="; 9 }; 10in stdenv.mkDerivation { 11 pname = "meshoptimizer"; 12 version = "unstable-2023-03-22"; 13 src = fetchFromGitHub { 14 owner = "zeux"; 15 repo = "meshoptimizer"; 16 hash = "sha256-OWeptdnKFvTyfkz0sFCpiTI7323GfVE8vb8bNUBnslA="; 17 rev = "49d9222385daf61a9ce75bb4699472408eb3df3e"; 18 }; 19 20 nativeBuildInputs = [ cmake ]; 21 22 outputs = [ "bin" "dev" "out" ]; 23 24 cmakeFlags = [ 25 "-DMESHOPT_BUILD_GLTFPACK=ON" 26 "-DMESHOPT_BASISU_PATH=${basis_universal}" 27 ] ++ lib.optional (!stdenv.hostPlatform.isStatic) 28 "-DMESHOPT_BUILD_SHARED_LIBS:BOOL=ON"; 29 30 meta = with lib; { 31 description = "Mesh optimization library that makes meshes smaller and faster to render"; 32 homepage = "https://github.com/zeux/meshoptimizer"; 33 license = licenses.mit; 34 maintainers = [ maintainers.lillycham ]; 35 platforms = platforms.all; 36 mainProgram = "gltfpack"; 37 }; 38}