Graphite/.nix/rust-gpu.nix
blue linden 5acf50c1ef
Some checks failed
Editor: Dev & CI / build (push) Has been cancelled
Editor: Dev & CI / cargo-deny (push) Has been cancelled
Reduce Nix flake maintanace by eliminating need for cargoHash bumps (#3292)
* prepare nix for hashless cargo builds, update rust-gpu to non-orphaned
commit

* match commit hashes to repos, update packages to make nix flake build
properly

* add nix build dir to gitignore

* Add npm TODO to flake.nix

* Update Cargo.lock

* Update TODO comment
2025-10-18 22:56:26 +00:00

47 lines
1.4 KiB
Nix

{ pkgs }:
let
toolchainPkg = pkgs.rust-bin.nightly."2025-06-23".default.override {
extensions =
[ "rust-src" "rust-analyzer" "clippy" "cargo" "rustc-dev" "llvm-tools" ];
};
toolchainRustPlatform = pkgs.makeRustPlatform {
cargo = toolchainPkg;
rustc = toolchainPkg;
};
rustc_codegen_spirv = toolchainRustPlatform.buildRustPackage (finalAttrs: {
pname = "rustc_codegen_spirv";
version = "0-unstable-2025-08-04";
src = pkgs.fetchFromGitHub {
owner = "Firestar99";
repo = "rust-gpu-new";
rev = "c12f216121820580731440ee79ebc7403d6ea04f";
hash = "sha256-rG1cZvOV0vYb1dETOzzbJ0asYdE039UZImobXZfKIno=";
};
cargoHash = "sha256-AEigcEc5wiBd3zLqWN/2HSbkfOVFneAqNvg9HsouZf4=";
cargoBuildFlags = [
"-p"
"rustc_codegen_spirv"
"--features=use-compiled-tools"
"--no-default-features"
];
doCheck = false;
});
cargoWrapper = pkgs.writeShellScriptBin "cargo" ''
#!${pkgs.lib.getExe pkgs.bash}
filtered_args=()
for arg in "$@"; do
case "$arg" in
+nightly|+nightly-*) ;;
*) filtered_args+=("$arg") ;;
esac
done
exec ${toolchainPkg}/bin/cargo ${"\${filtered_args[@]}"}
'';
in {
RUST_GPU_PATH_OVERRIDE = "${cargoWrapper}/bin:${toolchainPkg}/bin";
RUSTC_CODEGEN_SPIRV_PATH =
"${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
}