Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
result/
*.spv
*.exrc
perf.data*
Expand Down
29 changes: 15 additions & 14 deletions .nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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";
Expand Down Expand Up @@ -144,13 +144,14 @@
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" \
--prefix LD_LIBRARY_PATH : "${libPath}" \
--set CEF_PATH "${cefEnv.CEF_PATH}"
'';
});
}
);
});
}
20 changes: 13 additions & 7 deletions .nix/rust-gpu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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" ''
Expand All @@ -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";
}
50 changes: 25 additions & 25 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))'] }
Expand Down
Loading