-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6280236
commit 7ba710e
Showing
5 changed files
with
97 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ stdenv, fetchurl, unzip }: | ||
|
||
let | ||
sk_gpu_zip = fetchurl { | ||
url = | ||
"https://github.com/StereoKit/sk_gpu/releases/download/v2024.8.12/sk_gpu.v2024.8.12.zip"; | ||
sha256 = "sha256-NPjOFzu7AlpQKJ8PZYeUuegrR6TXtRyg+Hm2BxIAMLI="; | ||
}; | ||
in stdenv.mkDerivation rec { | ||
name = "sk_gpu"; | ||
src = sk_gpu_zip; | ||
unpackPhase = '' | ||
unzip -d $out ${sk_gpu_zip} | ||
''; | ||
nativeBuildInputs = [ unzip ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,70 @@ | ||
{ rustPlatform | ||
, src | ||
, name | ||
, openxr-loader | ||
, libGL | ||
, mesa | ||
, xorg | ||
, fontconfig | ||
, libxkbcommon | ||
, libclang | ||
, cmake | ||
, cpm-cmake | ||
, pkg-config | ||
, llvmPackages | ||
, meshoptimizer | ||
}: | ||
{ rustPlatform, src, name, libGL, mesa, xorg, fontconfig, libxkbcommon, libclang | ||
, cmake, cpm-cmake, pkg-config, llvmPackages, fetchFromGitHub, sk_gpu, libXau | ||
, libXdmcp, stdenv, lib }: | ||
|
||
rustPlatform.buildRustPackage rec { | ||
inherit src name; | ||
cargoLock = { | ||
lockFile = (src + "/Cargo.lock"); | ||
allowBuiltinFetchGit = true; | ||
}; | ||
FORCE_LOCAL_DEPS = true; | ||
CPM_LOCAL_PACKAGES_ONLY = true; | ||
CPM_SOURCE_CACHE = "./build"; | ||
postPatch = '' | ||
CPM_USE_LOCAL_PACKAGES = true; | ||
CPM_DOWNLOAD_ALL = false; | ||
|
||
openxr_loader = fetchFromGitHub { | ||
owner = "KhronosGroup"; | ||
repo = "OpenXR-SDK"; | ||
rev = "288d3a7ebc1ad959f62d51da75baa3d27438c499"; | ||
sha256 = "sha256-RdmnBe26hqPmqwCHIJolF6bSmZRmIKVlGF+TXAY35ig="; | ||
}; | ||
meshoptimizer = fetchFromGitHub { | ||
owner = "zeux"; | ||
repo = "meshoptimizer"; | ||
rev = "c21d3be6ddf627f8ca852ba4b6db9903b0557858"; | ||
sha256 = "sha256-QCxpM2g8WtYSZHkBzLTJNQ/oHb5j/n9rjaVmZJcCZIA="; | ||
}; | ||
basis_universal = fetchFromGitHub { | ||
owner = "BinomialLLC"; | ||
repo = "basis_universal"; | ||
rev = "900e40fb5d2502927360fe2f31762bdbb624455f"; | ||
sha256 = "sha256-zBRAXgG5Fi6+5uPQCI/RCGatY6O4ELuYBoKrPNn4K+8="; | ||
}; | ||
|
||
DEP_OPENXR_LOADER_SOURCE = "${openxr_loader}"; | ||
DEP_MESHOPTIMIZER_SOURCE = "${meshoptimizer}"; | ||
DEP_BASIS_UNIVERSAL_SOURCE = "${basis_universal}"; | ||
|
||
postPatch = let libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib ]; | ||
in '' | ||
sk=$(echo $cargoDepsCopy/stereokit-rust-*/StereoKit) | ||
mkdir -p $sk/build/cpm | ||
# This is not ideal, the original approach was to fetch the exact cmake | ||
# file version that was wanted from GitHub directly, but at least this way it comes from Nixpkgs.. so meh | ||
cp ${cpm-cmake}/share/cpm/CPM.cmake $sk/build/cpm/CPM_0.38.7.cmake | ||
mkdir -p $sk/sk_gpu | ||
cp -R ${sk_gpu}/* $sk/sk_gpu | ||
chmod -R 755 $sk/sk_gpu/tools/linux_x64/* | ||
export DEP_SK_GPU_SOURCE=$sk/sk_gpu | ||
export LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib"; | ||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | ||
--set-rpath "${libPath}" \ | ||
$sk/sk_gpu/tools/linux_x64/skshaderc | ||
''; | ||
nativeBuildInputs = [ | ||
cmake pkg-config llvmPackages.libcxxClang | ||
]; | ||
nativeBuildInputs = [ cmake pkg-config llvmPackages.libcxxClang ]; | ||
buildInputs = [ | ||
openxr-loader libGL mesa xorg.libX11 fontconfig libxkbcommon meshoptimizer | ||
libGL | ||
mesa | ||
xorg.libX11.dev | ||
xorg.libXft | ||
xorg.libXfixes | ||
fontconfig | ||
libxkbcommon | ||
libXau | ||
libXdmcp | ||
]; | ||
LIBCLANG_PATH = "${libclang.lib}/lib"; | ||
} | ||
} |