mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 06:48:11 +08:00
Add nix configuration for the rust-gpu toolchain (#3027)
* nix: Try providing cargo-rust-gpu to nix devs, naga branch * nix: Try providing cargo-rust-gpu to nix devs 2 * nix: Add exec with rust-gpu env script to flake * nix: override Path for rust gpu * nix: rust-gpu with `use-compiled-tools` to fix differences * nix: remove spirv-tools --------- Co-authored-by: firestar99 <firestar99@sydow.cloud>
This commit is contained in:
+42
-4
@@ -34,11 +34,47 @@
|
|||||||
inherit system overlays;
|
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" ];
|
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" ];
|
||||||
|
};
|
||||||
|
rustGPUToolchainRustPlatform = pkgs.makeRustPlatform {
|
||||||
|
cargo = rustGPUToolchainPkg;
|
||||||
|
rustc = rustGPUToolchainPkg;
|
||||||
|
};
|
||||||
|
rustc_codegen_spirv = rustGPUToolchainRustPlatform.buildRustPackage (finalAttrs: {
|
||||||
|
pname = "rustc_codegen_spirv";
|
||||||
|
version = "0-unstable-2025-08-04";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "Rust-GPU";
|
||||||
|
repo = "rust-gpu";
|
||||||
|
rev = "c12f216121820580731440ee79ebc7403d6ea04f";
|
||||||
|
hash = "sha256-rG1cZvOV0vYb1dETOzzbJ0asYdE039UZImobXZfKIno=";
|
||||||
|
};
|
||||||
|
cargoHash = "sha256-AEigcEc5wiBd3zLqWN/2HSbkfOVFneAqNvg9HsouZf4=";
|
||||||
|
cargoBuildFlags = [ "-p" "rustc_codegen_spirv" "--features=use-compiled-tools" "--no-default-features" ];
|
||||||
|
doCheck = false;
|
||||||
|
});
|
||||||
|
rustGpuCargo = 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 ${rustGPUToolchainPkg}/bin/cargo ${"\${filtered_args[@]}"}
|
||||||
|
'';
|
||||||
|
rustGpuPathOverride = "${rustGpuCargo}/bin:${rustGPUToolchainPkg}/bin";
|
||||||
|
|
||||||
libcef = pkgs.libcef.overrideAttrs (finalAttrs: previousAttrs: {
|
libcef = pkgs.libcef.overrideAttrs (finalAttrs: previousAttrs: {
|
||||||
version = "139.0.17";
|
version = "139.0.17";
|
||||||
gitRevision = "6c347eb";
|
gitRevision = "6c347eb";
|
||||||
@@ -51,7 +87,6 @@
|
|||||||
strip $out/lib/*
|
strip $out/lib/*
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
libcefPath = pkgs.runCommand "libcef-path" {} ''
|
libcefPath = pkgs.runCommand "libcef-path" {} ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
@@ -85,7 +120,7 @@
|
|||||||
|
|
||||||
# Development tools that don't need to be in LD_LIBRARY_PATH
|
# Development tools that don't need to be in LD_LIBRARY_PATH
|
||||||
buildTools = [
|
buildTools = [
|
||||||
rustc-wasm
|
rust
|
||||||
pkgs.nodejs
|
pkgs.nodejs
|
||||||
pkgs.nodePackages.npm
|
pkgs.nodePackages.npm
|
||||||
pkgs.binaryen
|
pkgs.binaryen
|
||||||
@@ -119,6 +154,9 @@
|
|||||||
CEF_PATH = libcefPath;
|
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";
|
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";
|
||||||
|
|
||||||
|
RUST_GPU_PATH_OVERRIDE = rustGpuPathOverride;
|
||||||
|
RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
alias cargo='mold --run cargo'
|
alias cargo='mold --run cargo'
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user