Skip to content

Commit 2a66b9c

Browse files
timon-schellingFirestar99
authored andcommitted
Try providing cargo-rust-gpu to nix devs
1 parent 91ca11b commit 2a66b9c

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.nix/flake.nix

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@
5050
rustc = rustNightlyPkg;
5151
};
5252

53-
rustc_codegen_spirv = (rustPlatformNightly.buildRustPackage.override {
54-
stdenv = pkgs.llvmPackages.stdenv;
55-
}) (finalAttrs: {
53+
rustc_codegen_spirv = rustPlatformNightly.buildRustPackage (finalAttrs: {
5654
pname = "rustc_codegen_spirv";
5755
version = "0-unstable-2025-08-04";
5856
src = pkgs.fetchFromGitHub {
@@ -63,19 +61,32 @@
6361
};
6462
cargoHash = "sha256-en3BYJWQabH064xeAwYQrvcr6EuWg/QjvsG+Jd6HHCk";
6563

66-
cargoBuildFlags = [ "-p" "rustc_codegen_spirv" ];
64+
cargoBuildFlags = [ "-p" "rustc_codegen_spirv" "--features=use-installed-tools" "--no-default-features" ];
6765

6866
doCheck = false;
6967
});
7068

71-
cargoRustGpuBuild = pkgs.writeShellScriptBin "cargo-rust-gpu" ''
69+
cargoGpuPkg = rustPlatformNightly.buildRustPackage (finalAttrs: {
70+
pname = "cargo-gpu";
71+
version = "0-unstable-2025-07-24";
72+
src = pkgs.fetchFromGitHub {
73+
owner = "Rust-GPU";
74+
repo = "cargo-gpu";
75+
rev = "a2ad3574dd32142ff661994e0d79448a45d18f47";
76+
hash = "sha256-YGu9Cuw+pcN9/rCuCxImouzsQ3ScHF+cW6zgxMm0XGI=";
77+
};
78+
cargoHash = "sha256-tyad9kO90uwAnMQYa09takIBXifrumSx2C4rpSK95aM=";
79+
80+
doCheck = false;
81+
});
82+
83+
cargoNightlyPkg = pkgs.writeShellScriptBin "cargo-nightly" ''
7284
#!${pkgs.bash}/bin/bash
7385
74-
export PATH="${pkgs.lib.makeBinPath [rustNightlyPkg]}"
75-
export RUSTFLAGS="-Zcodegen-backend=${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so"
76-
exec cargo +nightly $@
86+
exec ${rustNightlyPkg}/bin/cargo $@
7787
'';
7888

89+
7990
libcef = pkgs.libcef.overrideAttrs (finalAttrs: previousAttrs: {
8091
version = "139.0.17";
8192
gitRevision = "6c347eb";
@@ -135,7 +146,9 @@
135146
# Linker
136147
pkgs.mold
137148

138-
cargoRustGpuBuild
149+
pkgs.spirv-tools
150+
cargoNightlyPkg
151+
cargoGpuPkg
139152
];
140153
# Development tools that don't need to be in LD_LIBRARY_PATH
141154
devTools = with pkgs; [
@@ -158,6 +171,8 @@
158171
CEF_PATH = libcefPath;
159172
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";
160173

174+
RUSTC_CODEGEN_SPIRV="${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
175+
161176
shellHook = ''
162177
alias cargo='mold --run cargo'
163178
'';

0 commit comments

Comments
 (0)