Skip to content

Shaders #2985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

Shaders #2985

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .nix/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 55 additions & 4 deletions .nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,57 @@
pkgs = import nixpkgs {
inherit system overlays;
};

rustc-wasm = pkgs.rust-bin.stable.latest.default.override {

rustExtensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" ];

rust = pkgs.rust-bin.stable.latest.default.override {
targets = [ "wasm32-unknown-unknown" ];
extensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" ];
extensions = rustExtensions;
};

rustGPUToolchainPkg = pkgs.rust-bin.nightly."2025-06-23".default.override {
extensions = rustExtensions ++ [ "rustc-dev" "llvm-tools" ];
};

rustPlatformRustGPUToolchain = pkgs.makeRustPlatform {
cargo = rustGPUToolchainPkg;
rustc = rustGPUToolchainPkg;
};

rustc_codegen_spirv = rustPlatformRustGPUToolchain.buildRustPackage (finalAttrs: {
pname = "rustc_codegen_spirv";
version = "0-unstable-2025-08-04";
src = pkgs.fetchFromGitHub {
owner = "Rust-GPU";
repo = "rust-gpu";
rev = "3f05f5482824e3b1fbb44c9ef90a8795a0204c7c";
hash = "sha256-ygNxjkzuvcO2jLYhayNuIthhH6/seCbTq3M0IkbsDrY=";
};
cargoHash = "sha256-SzTvKUG/da//pHb7hN230wRsQ6BYAkP8HoXqJO30/dU=";

cargoBuildFlags = [ "-p" "rustc_codegen_spirv" "--features=use-installed-tools" "--no-default-features" ];

doCheck = false;
});


cargoRustGPUPkg = pkgs.writeShellScriptBin "cargo" ''
#!${pkgs.bash}/bin/bash

filtered_args=()
for arg in "$@"; do
case "$arg" in
+nightly|+nightly-*) ;;
*) filtered_args+=("$arg") ;;
esac
done

echo "running cargo with rust-gpu toolchain"
echo "cargo ${"\${filtered_args[@]}"}"
exec ${rustGPUToolchainPkg}/bin/cargo ${"\${filtered_args[@]}"}
'';


libcef = pkgs.libcef.overrideAttrs (finalAttrs: previousAttrs: {
version = "138.0.26";
gitRevision = "84f2d27";
Expand Down Expand Up @@ -79,7 +124,7 @@

# Development tools that don't need to be in LD_LIBRARY_PATH
buildTools = [
rustc-wasm
# rust
pkgs.nodejs
pkgs.nodePackages.npm
pkgs.binaryen
Expand All @@ -91,6 +136,10 @@

# Linker
pkgs.mold

pkgs.spirv-tools
cargoRustGPUPkg
rustGPUToolchainPkg
];
# Development tools that don't need to be in LD_LIBRARY_PATH
devTools = with pkgs; [
Expand All @@ -113,6 +162,8 @@
CEF_PATH = libcefPath;
XDG_DATA_DIRS="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";

RUSTC_CODEGEN_SPIRV_PATH="${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";

shellHook = ''
alias cargo='mold --run cargo'
'';
Expand Down
Loading
Loading