diff --git a/.gitignore b/.gitignore index 29af1eed11..92eb3381b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ +result/ *.spv *.exrc perf.data* diff --git a/.nix/flake.nix b/.nix/flake.nix index 5ef0f63c7d..223fdade09 100644 --- a/.nix/flake.nix +++ b/.nix/flake.nix @@ -28,9 +28,7 @@ flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { - inherit system overlays; - }; + pkgs = import nixpkgs { inherit system overlays; }; rustExtensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" ]; rust = pkgs.rust-bin.stable.latest.default.override { @@ -54,12 +52,12 @@ ]; # Packages needed to build the package - buildTools = [ + buildTools = [ rust pkgs.nodejs pkgs.nodePackages.npm pkgs.binaryen - pkgs.wasm-bindgen-cli + pkgs.wasm-bindgen-cli_0_2_100 pkgs.wasm-pack pkgs.pkg-config pkgs.cargo-about @@ -86,29 +84,31 @@ rustGPUEnv = import ./rust-gpu.nix { inherit pkgs; }; libPath = "${pkgs.lib.makeLibraryPath buildInputs}:${cefEnv.CEF_PATH}"; - in - { + in { devShells.default = pkgs.mkShell ({ packages = buildInputs ++ buildTools ++ devTools; LD_LIBRARY_PATH = libPath; - 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"; shellHook = '' alias cargo='mold --run cargo' ''; } // cefEnv // rustGPUEnv); - packages.default = pkgs.stdenv.mkDerivation(finalAttrs: { + packages.default = pkgs.rustPlatform.buildRustPackage (finalAttrs: { pname = "graphite-editor"; version = "unstable"; src = pkgs.lib.cleanSource ./..; - cargoDeps = pkgs.rustPlatform.fetchCargoVendor { - src = finalAttrs.src; - hash = "sha256-BVIQIZbGW19Rof0J7U2r6XFCUC52hb7+uaE1di4bV4A="; + cargoLock = { + lockFile = ../Cargo.lock; + allowBuiltinFetchGit = true; }; + + # TODO: Remove the need for this hash by using individual package resolutions and hashes from package-lock.json npmDeps = pkgs.fetchNpmDeps { inherit (finalAttrs) pname version; src = "${finalAttrs.src}/frontend"; @@ -144,6 +144,8 @@ mkdir -p $out/share/icons/hicolor/scalable/apps cp $src/desktop/assets/graphite-icon-color.svg $out/share/icons/hicolor/scalable/apps/ ''; + + doCheck = false; postFixup = '' wrapProgram "$out/bin/graphite-editor" \ @@ -151,6 +153,5 @@ --set CEF_PATH "${cefEnv.CEF_PATH}" ''; }); - } - ); + }); } diff --git a/.nix/rust-gpu.nix b/.nix/rust-gpu.nix index 7f92e06732..30836da646 100644 --- a/.nix/rust-gpu.nix +++ b/.nix/rust-gpu.nix @@ -2,7 +2,8 @@ let toolchainPkg = pkgs.rust-bin.nightly."2025-06-23".default.override { - extensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" "rustc-dev" "llvm-tools" ]; + extensions = + [ "rust-src" "rust-analyzer" "clippy" "cargo" "rustc-dev" "llvm-tools" ]; }; toolchainRustPlatform = pkgs.makeRustPlatform { cargo = toolchainPkg; @@ -12,13 +13,18 @@ let pname = "rustc_codegen_spirv"; version = "0-unstable-2025-08-04"; src = pkgs.fetchFromGitHub { - owner = "Rust-GPU"; - repo = "rust-gpu"; + 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" ]; + cargoBuildFlags = [ + "-p" + "rustc_codegen_spirv" + "--features=use-compiled-tools" + "--no-default-features" + ]; doCheck = false; }); cargoWrapper = pkgs.writeShellScriptBin "cargo" '' @@ -34,8 +40,8 @@ let exec ${toolchainPkg}/bin/cargo ${"\${filtered_args[@]}"} ''; -in -{ +in { RUST_GPU_PATH_OVERRIDE = "${cargoWrapper}/bin:${toolchainPkg}/bin"; - RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so"; + RUSTC_CODEGEN_SPIRV_PATH = + "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so"; } diff --git a/Cargo.lock b/Cargo.lock index 5e620f0b22..961ee8dec4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -648,7 +648,7 @@ dependencies = [ [[package]] name = "cargo-gpu" version = "0.1.0" -source = "git+https://github.com/rust-gpu/cargo-gpu?rev=3952a22d16edbd38689f3a876e417899f21e1fe7#3952a22d16edbd38689f3a876e417899f21e1fe7" +source = "git+https://github.com/Firestar99/cargo-gpu?rev=3952a22d16edbd38689f3a876e417899f21e1fe7#3952a22d16edbd38689f3a876e417899f21e1fe7" dependencies = [ "anyhow", "cargo_metadata", @@ -1245,7 +1245,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1317,7 +1317,7 @@ dependencies = [ [[package]] name = "dpi" version = "0.1.2" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "serde", ] @@ -1461,7 +1461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4373,7 +4373,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4794,7 +4794,7 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc_codegen_spirv-target-specs" version = "0.9.0" -source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#3f05f5482824e3b1fbb44c9ef90a8795a0204c7c" dependencies = [ "serde", "strum 0.27.2", @@ -4804,7 +4804,7 @@ dependencies = [ [[package]] name = "rustc_codegen_spirv-types" version = "0.9.0" -source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#3f05f5482824e3b1fbb44c9ef90a8795a0204c7c" dependencies = [ "rspirv", "serde", @@ -4822,7 +4822,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -5328,7 +5328,7 @@ dependencies = [ [[package]] name = "spirv-builder" version = "0.9.0" -source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" +source = "git+https://github.com/Rust-GPU/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#3f05f5482824e3b1fbb44c9ef90a8795a0204c7c" dependencies = [ "cargo_metadata", "clap", @@ -5347,7 +5347,7 @@ dependencies = [ [[package]] name = "spirv-std" version = "0.9.0" -source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" +source = "git+https://github.com/Firestar99/rust-gpu-new?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" dependencies = [ "bitflags 1.3.2", "bytemuck", @@ -5361,7 +5361,7 @@ dependencies = [ [[package]] name = "spirv-std-macros" version = "0.9.0" -source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" +source = "git+https://github.com/Firestar99/rust-gpu-new?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" dependencies = [ "proc-macro2", "quote", @@ -5372,7 +5372,7 @@ dependencies = [ [[package]] name = "spirv-std-types" version = "0.9.0" -source = "git+https://github.com/rust-gpu/rust-gpu?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" +source = "git+https://github.com/Firestar99/rust-gpu-new?rev=c12f216121820580731440ee79ebc7403d6ea04f#c12f216121820580731440ee79ebc7403d6ea04f" [[package]] name = "stable_deref_trait" @@ -5586,7 +5586,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -6780,7 +6780,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -7163,7 +7163,7 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winit" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "cfg_aliases", @@ -7190,7 +7190,7 @@ dependencies = [ [[package]] name = "winit-android" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "android-activity", "bitflags 2.9.3", @@ -7205,7 +7205,7 @@ dependencies = [ [[package]] name = "winit-appkit" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "block2", @@ -7227,7 +7227,7 @@ dependencies = [ [[package]] name = "winit-common" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "memmap2", "objc2", @@ -7242,7 +7242,7 @@ dependencies = [ [[package]] name = "winit-core" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "cursor-icon", @@ -7257,7 +7257,7 @@ dependencies = [ [[package]] name = "winit-orbital" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "dpi", @@ -7272,7 +7272,7 @@ dependencies = [ [[package]] name = "winit-uikit" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "block2", @@ -7293,7 +7293,7 @@ dependencies = [ [[package]] name = "winit-wayland" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "ahash", "bitflags 2.9.3", @@ -7319,7 +7319,7 @@ dependencies = [ [[package]] name = "winit-web" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "atomic-waker", "bitflags 2.9.3", @@ -7341,7 +7341,7 @@ dependencies = [ [[package]] name = "winit-win32" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "cursor-icon", @@ -7357,7 +7357,7 @@ dependencies = [ [[package]] name = "winit-x11" version = "0.30.12" -source = "git+https://github.com/rust-windowing/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" +source = "git+https://github.com/timon-schelling/winit.git?rev=37221c7192ef1deec022a2278e54429331c01bad#37221c7192ef1deec022a2278e54429331c01bad" dependencies = [ "bitflags 2.9.3", "bytemuck", diff --git a/Cargo.toml b/Cargo.toml index ba841a7487..c666091b2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,7 +132,7 @@ web-sys = { version = "=0.3.77", features = [ "HtmlImageElement", "ImageBitmapRenderingContext", ] } -winit = { git = "https://github.com/rust-windowing/winit.git", rev = "37221c7192ef1deec022a2278e54429331c01bad" } +winit = { git = "https://github.com/timon-schelling/winit.git", rev = "37221c7192ef1deec022a2278e54429331c01bad" } url = "2.5" tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt"] } vello = { git = "https://github.com/linebender/vello.git", rev = "87cc5bee6d3a34d15017dbbb58634ddc7f33ff9b" } # TODO switch back to stable when a release is made @@ -195,8 +195,8 @@ open = "5.3" poly-cool = "0.3" spin = "0.10" clap = "4.5" -spirv-std = { git = "https://github.com/rust-gpu/rust-gpu", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] } -cargo-gpu = { git = "https://github.com/rust-gpu/cargo-gpu", rev = "3952a22d16edbd38689f3a876e417899f21e1fe7", default-features = false } +spirv-std = { git = "https://github.com/Firestar99/rust-gpu-new", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] } +cargo-gpu = { git = "https://github.com/Firestar99/cargo-gpu", rev = "3952a22d16edbd38689f3a876e417899f21e1fe7", default-features = false } [workspace.lints.rust] unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }