mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Desktop: Enable GPU nodes (#3364)
* desktop simple nix ci * make workflow manual * fixup * fix nix shell * nix fmt * fix shell
This commit is contained in:
26
.nix/cef.nix
26
.nix/cef.nix
@@ -1,26 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
let
|
||||
libcef = pkgs.libcef.overrideAttrs (_: _: {
|
||||
postInstall = ''
|
||||
strip $out/lib/*
|
||||
'';
|
||||
});
|
||||
cefPath = pkgs.runCommand "cef-path" {} ''
|
||||
mkdir -p $out
|
||||
|
||||
ln -s ${libcef}/include $out/include
|
||||
find ${libcef}/lib -type f -name "*" -exec ln -s {} $out/ \;
|
||||
find ${libcef}/libexec -type f -name "*" -exec ln -s {} $out/ \;
|
||||
cp -r ${libcef}/share/cef/* $out/
|
||||
|
||||
echo '${builtins.toJSON {
|
||||
type = "minimal";
|
||||
name = builtins.baseNameOf libcef.src.url;
|
||||
sha1 = "";
|
||||
}}' > $out/archive.json
|
||||
'';
|
||||
in
|
||||
{
|
||||
CEF_PATH = cefPath;
|
||||
}
|
||||
30
.nix/deps/cef.nix
Normal file
30
.nix/deps/cef.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ pkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
libcef = pkgs.libcef.overrideAttrs (
|
||||
_: _: {
|
||||
postInstall = ''
|
||||
strip $out/lib/*
|
||||
'';
|
||||
}
|
||||
);
|
||||
cefPath = pkgs.runCommand "cef-path" { } ''
|
||||
mkdir -p $out
|
||||
|
||||
ln -s ${libcef}/include $out/include
|
||||
find ${libcef}/lib -type f -name "*" -exec ln -s {} $out/ \;
|
||||
find ${libcef}/libexec -type f -name "*" -exec ln -s {} $out/ \;
|
||||
cp -r ${libcef}/share/cef/* $out/
|
||||
|
||||
echo '${
|
||||
builtins.toJSON {
|
||||
type = "minimal";
|
||||
name = builtins.baseNameOf libcef.src.url;
|
||||
sha1 = "";
|
||||
}
|
||||
}' > $out/archive.json
|
||||
'';
|
||||
in
|
||||
{
|
||||
env.CEF_PATH = cefPath;
|
||||
}
|
||||
5
.nix/deps/crane.nix
Normal file
5
.nix/deps/crane.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{ pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
lib = inputs.crane.mkLib pkgs;
|
||||
}
|
||||
58
.nix/deps/rust-gpu.nix
Normal file
58
.nix/deps/rust-gpu.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{ pkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
extensions = [
|
||||
"rust-src"
|
||||
"rust-analyzer"
|
||||
"clippy"
|
||||
"cargo"
|
||||
"rustc-dev"
|
||||
"llvm-tools"
|
||||
];
|
||||
toolchain = pkgs.rust-bin.nightly."2025-06-23".default.override {
|
||||
inherit extensions;
|
||||
};
|
||||
cargo = 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 ${toolchain}/bin/cargo ${"\${filtered_args[@]}"}
|
||||
'';
|
||||
rustc_codegen_spirv =
|
||||
(pkgs.makeRustPlatform {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
}).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;
|
||||
});
|
||||
in
|
||||
{
|
||||
toolchain = toolchain;
|
||||
env = {
|
||||
RUST_GPU_PATH_OVERRIDE = "${cargo}/bin:${toolchain}/bin";
|
||||
RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
|
||||
};
|
||||
}
|
||||
22
.nix/dev.nix
Normal file
22
.nix/dev.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
pkgs,
|
||||
deps,
|
||||
libs,
|
||||
tools,
|
||||
...
|
||||
}:
|
||||
|
||||
pkgs.mkShell (
|
||||
{
|
||||
packages = tools.all ++ libs.all;
|
||||
|
||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs.all}:${deps.cef.env.CEF_PATH}";
|
||||
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'
|
||||
'';
|
||||
}
|
||||
// deps.cef.env
|
||||
// deps.rustGPU.env
|
||||
)
|
||||
16
.nix/flake.lock
generated
16
.nix/flake.lock
generated
@@ -1,5 +1,20 @@
|
||||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1762538466,
|
||||
"narHash": "sha256-8zrIPl6J+wLm9MH5ksHcW7BUHo7jSNOu0/hA0ohOOaM=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "0cea393fffb39575c46b7a0318386467272182fe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"locked": {
|
||||
"lastModified": 1733328505,
|
||||
@@ -50,6 +65,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
|
||||
232
.nix/flake.nix
232
.nix/flake.nix
@@ -19,141 +19,137 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
# This is used to provide a identical development shell at `shell.nix` for users that do not use flakes
|
||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, rust-overlay, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
|
||||
rustExtensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" ];
|
||||
rust = pkgs.rust-bin.stable.latest.default.override {
|
||||
targets = [ "wasm32-unknown-unknown" ];
|
||||
extensions = rustExtensions;
|
||||
info = {
|
||||
pname = "graphite";
|
||||
version = "unstable";
|
||||
src = ./..;
|
||||
};
|
||||
|
||||
# Shared build inputs; libraries that need to be in LD_LIBRARY_PATH
|
||||
buildInputs = [
|
||||
pkgs.wayland
|
||||
pkgs.openssl
|
||||
pkgs.vulkan-loader
|
||||
pkgs.libraw
|
||||
pkgs.libGL
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ (import inputs.rust-overlay) ];
|
||||
};
|
||||
|
||||
# X11 libraries, not needed on wayland! Remove when x11 is finally dead
|
||||
pkgs.libxkbcommon
|
||||
pkgs.xorg.libXcursor
|
||||
pkgs.xorg.libxcb
|
||||
pkgs.xorg.libX11
|
||||
];
|
||||
deps = {
|
||||
crane = import ./deps/crane.nix { inherit pkgs inputs; };
|
||||
cef = import ./deps/cef.nix { inherit pkgs inputs; };
|
||||
rustGPU = import ./deps/rust-gpu.nix { inherit pkgs inputs; };
|
||||
};
|
||||
|
||||
# Packages needed to build the package
|
||||
buildTools = [
|
||||
rust
|
||||
pkgs.nodejs
|
||||
pkgs.nodePackages.npm
|
||||
pkgs.binaryen
|
||||
pkgs.wasm-bindgen-cli_0_2_100
|
||||
pkgs.wasm-pack
|
||||
pkgs.pkg-config
|
||||
pkgs.cargo-about
|
||||
];
|
||||
|
||||
# Development tools; not needed to build the package
|
||||
devTools = [
|
||||
pkgs.git
|
||||
|
||||
pkgs.cargo-watch
|
||||
pkgs.cargo-nextest
|
||||
pkgs.cargo-expand
|
||||
|
||||
# Linker
|
||||
pkgs.mold
|
||||
|
||||
# Profiling tools
|
||||
pkgs.gnuplot
|
||||
pkgs.samply
|
||||
pkgs.cargo-flamegraph
|
||||
];
|
||||
|
||||
cefEnv = import ./cef.nix { inherit pkgs; };
|
||||
rustGPUEnv = import ./rust-gpu.nix { inherit pkgs; };
|
||||
|
||||
libPath = "${pkgs.lib.makeLibraryPath buildInputs}:${cefEnv.CEF_PATH}";
|
||||
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";
|
||||
|
||||
shellHook = ''
|
||||
alias cargo='mold --run cargo'
|
||||
'';
|
||||
} // cefEnv // rustGPUEnv);
|
||||
|
||||
packages.default = pkgs.rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "graphite-editor";
|
||||
version = "unstable";
|
||||
src = pkgs.lib.cleanSource ./..;
|
||||
|
||||
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";
|
||||
hash = "sha256-UWuJpKNYj2Xn34rpMDZ75pzMYUOLQjPeGuJ/QlPbX9A=";
|
||||
};
|
||||
|
||||
npmRoot = "frontend";
|
||||
npmConfigScript = "setup";
|
||||
makeCacheWritable = true;
|
||||
|
||||
buildInputs = buildInputs;
|
||||
nativeBuildInputs = buildTools ++ [
|
||||
pkgs.rustPlatform.cargoSetupHook
|
||||
pkgs.npmHooks.npmConfigHook
|
||||
pkgs.makeWrapper
|
||||
libs = rec {
|
||||
desktop = [
|
||||
pkgs.wayland
|
||||
pkgs.openssl
|
||||
pkgs.vulkan-loader
|
||||
pkgs.libraw
|
||||
pkgs.libGL
|
||||
];
|
||||
desktop-x11 = [
|
||||
pkgs.libxkbcommon
|
||||
pkgs.xorg.libXcursor
|
||||
pkgs.xorg.libxcb
|
||||
pkgs.xorg.libX11
|
||||
];
|
||||
desktop-all = desktop ++ desktop-x11;
|
||||
all = desktop-all;
|
||||
};
|
||||
|
||||
env = cefEnv // rustGPUEnv;
|
||||
tools = rec {
|
||||
desktop = [
|
||||
pkgs.pkg-config
|
||||
];
|
||||
frontend = [
|
||||
pkgs.lld
|
||||
pkgs.nodejs
|
||||
pkgs.nodePackages.npm
|
||||
pkgs.binaryen
|
||||
pkgs.wasm-bindgen-cli_0_2_100
|
||||
pkgs.wasm-pack
|
||||
pkgs.cargo-about
|
||||
];
|
||||
dev = [
|
||||
pkgs.rustc
|
||||
pkgs.cargo
|
||||
pkgs.rust-analyzer
|
||||
pkgs.clippy
|
||||
|
||||
buildPhase = ''
|
||||
export HOME="$TMPDIR"
|
||||
pkgs.git
|
||||
|
||||
pushd frontend
|
||||
npm run build-native
|
||||
popd
|
||||
cargo build -r -p graphite-desktop
|
||||
'';
|
||||
pkgs.cargo-watch
|
||||
pkgs.cargo-nextest
|
||||
pkgs.cargo-expand
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp target/release/graphite-desktop $out/bin/graphite-editor
|
||||
# Linker
|
||||
pkgs.mold
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cp $src/desktop/assets/*.desktop $out/share/applications/
|
||||
# Profiling tools
|
||||
pkgs.gnuplot
|
||||
pkgs.samply
|
||||
pkgs.cargo-flamegraph
|
||||
];
|
||||
all = desktop ++ frontend ++ dev;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
graphiteWithArgs =
|
||||
args:
|
||||
(import ./pkgs/graphite.nix {
|
||||
pkgs = pkgs // {
|
||||
inherit graphene-raster-nodes-shaders;
|
||||
};
|
||||
inherit
|
||||
info
|
||||
inputs
|
||||
deps
|
||||
libs
|
||||
tools
|
||||
;
|
||||
})
|
||||
args;
|
||||
graphite = graphiteWithArgs { };
|
||||
graphite-dev = graphiteWithArgs { dev = true; };
|
||||
graphite-without-resources = graphiteWithArgs { embeddedResources = false; };
|
||||
graphite-without-resources-dev = graphiteWithArgs {
|
||||
embeddedResources = false;
|
||||
dev = true;
|
||||
};
|
||||
#TODO: graphene-cli = import ./pkgs/graphene-cli.nix { inherit info pkgs inputs deps libs tools; };
|
||||
graphene-raster-nodes-shaders = import ./pkgs/graphene-raster-nodes-shaders.nix {
|
||||
inherit
|
||||
info
|
||||
pkgs
|
||||
inputs
|
||||
deps
|
||||
libs
|
||||
tools
|
||||
;
|
||||
};
|
||||
|
||||
mkdir -p $out/share/icons/hicolor/scalable/apps
|
||||
cp $src/desktop/assets/graphite-icon-color.svg $out/share/icons/hicolor/scalable/apps/
|
||||
'';
|
||||
default = graphite;
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
devShells.default = import ./dev.nix {
|
||||
inherit
|
||||
pkgs
|
||||
deps
|
||||
libs
|
||||
tools
|
||||
;
|
||||
};
|
||||
|
||||
postFixup = ''
|
||||
wrapProgram "$out/bin/graphite-editor" \
|
||||
--prefix LD_LIBRARY_PATH : "${libPath}" \
|
||||
--set CEF_PATH "${cefEnv.CEF_PATH}"
|
||||
'';
|
||||
});
|
||||
});
|
||||
formatter = pkgs.nixfmt-tree;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
36
.nix/pkgs/graphene-raster-nodes-shaders.nix
Normal file
36
.nix/pkgs/graphene-raster-nodes-shaders.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
info,
|
||||
pkgs,
|
||||
inputs,
|
||||
deps,
|
||||
libs,
|
||||
tools,
|
||||
...
|
||||
}:
|
||||
|
||||
(deps.crane.lib.overrideToolchain (_: deps.rustGPU.toolchain)).buildPackage {
|
||||
pname = "graphene-raster-nodes-shaders";
|
||||
inherit (info) version src;
|
||||
|
||||
cargoVendorDir = deps.crane.lib.vendorMultipleCargoDeps {
|
||||
inherit (deps.crane.lib.findCargoFiles (deps.crane.lib.cleanCargoSource info.src)) cargoConfigs;
|
||||
cargoLockList = [
|
||||
"${info.src}/Cargo.lock"
|
||||
"${deps.rustGPU.toolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock"
|
||||
];
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
env = deps.rustGPU.env;
|
||||
|
||||
buildPhase = ''
|
||||
cargo build -r -p graphene-raster-nodes-shaders
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp target/spirv-builder/spirv-unknown-naga-wgsl/release/deps/graphene_raster_nodes_shaders_entrypoint.wgsl $out
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
}
|
||||
109
.nix/pkgs/graphite.nix
Normal file
109
.nix/pkgs/graphite.nix
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
info,
|
||||
pkgs,
|
||||
inputs,
|
||||
deps,
|
||||
libs,
|
||||
tools,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
embeddedResources ? true,
|
||||
dev ? false,
|
||||
}:
|
||||
|
||||
let
|
||||
resourcesCommon = {
|
||||
pname = "${info.pname}-resources";
|
||||
inherit (info) version src;
|
||||
strictDeps = true;
|
||||
doCheck = false;
|
||||
nativeBuildInputs = tools.frontend;
|
||||
env.CARGO_PROFILE = if dev then "dev" else "release";
|
||||
cargoExtraArgs = "--target wasm32-unknown-unknown -p graphite-wasm --no-default-features --features native";
|
||||
};
|
||||
resources = deps.crane.lib.buildPackage (
|
||||
resourcesCommon
|
||||
// {
|
||||
cargoArtifacts = deps.crane.lib.buildDepsOnly resourcesCommon;
|
||||
|
||||
# TODO: Remove the need for this hash by using individual package resolutions and hashes from package-lock.json
|
||||
npmDeps = pkgs.fetchNpmDeps {
|
||||
inherit (info) pname version;
|
||||
src = "${info.src}/frontend";
|
||||
hash = "sha256-UWuJpKNYj2Xn34rpMDZ75pzMYUOLQjPeGuJ/QlPbX9A=";
|
||||
};
|
||||
|
||||
npmRoot = "frontend";
|
||||
npmConfigScript = "setup";
|
||||
makeCacheWritable = true;
|
||||
|
||||
nativeBuildInputs = tools.frontend ++ [ pkgs.npmHooks.npmConfigHook ];
|
||||
|
||||
buildPhase = ''
|
||||
export HOME="$TMPDIR"
|
||||
|
||||
pushd frontend
|
||||
npm run build-native${if dev then "-dev" else ""}
|
||||
popd
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r frontend/dist/* $out/
|
||||
'';
|
||||
}
|
||||
);
|
||||
common = {
|
||||
inherit (info) pname version src;
|
||||
strictDeps = true;
|
||||
buildInputs = libs.desktop-all;
|
||||
nativeBuildInputs = tools.desktop ++ [ pkgs.makeWrapper ];
|
||||
env = deps.cef.env // {
|
||||
CARGO_PROFILE = if dev then "dev" else "release";
|
||||
};
|
||||
cargoExtraArgs = "-p graphite-desktop${
|
||||
if embeddedResources then "" else " --no-default-features --features recommended"
|
||||
}";
|
||||
doCheck = false;
|
||||
};
|
||||
in
|
||||
|
||||
deps.crane.lib.buildPackage (
|
||||
common
|
||||
// {
|
||||
cargoArtifacts = deps.crane.lib.buildDepsOnly common;
|
||||
|
||||
env =
|
||||
common.env
|
||||
// {
|
||||
GRAPHENE_RASTER_NODES_SHADER_PATH = pkgs.graphene-raster-nodes-shaders;
|
||||
}
|
||||
// (
|
||||
if embeddedResources then
|
||||
{
|
||||
EMBEDDED_RESOURCES = resources;
|
||||
}
|
||||
else
|
||||
{ }
|
||||
);
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp target/${if dev then "debug" else "release"}/graphite $out/bin/graphite
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cp $src/desktop/assets/*.desktop $out/share/applications/
|
||||
|
||||
mkdir -p $out/share/icons/hicolor/scalable/apps
|
||||
cp $src/desktop/assets/graphite-icon-color.svg $out/share/icons/hicolor/scalable/apps/
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
wrapProgram "$out/bin/graphite" \
|
||||
--prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath libs.desktop-all}:${deps.cef.env.CEF_PATH}" \
|
||||
--set CEF_PATH "${deps.cef.env.CEF_PATH}"
|
||||
'';
|
||||
}
|
||||
)
|
||||
@@ -1,47 +0,0 @@
|
||||
{ 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";
|
||||
}
|
||||
@@ -16,16 +16,13 @@
|
||||
# > nix-shell .nix --command "npm start"
|
||||
|
||||
# Uses flake compat to provide a development shell that is identical to the one defined in the flake
|
||||
(import
|
||||
(
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
nodeName = lock.nodes.root.inputs.flake-compat;
|
||||
in
|
||||
fetchTarball {
|
||||
url = lock.nodes.${nodeName}.locked.url;
|
||||
sha256 = lock.nodes.${nodeName}.locked.narHash;
|
||||
}
|
||||
)
|
||||
{ src = ./.; }
|
||||
).shellNix
|
||||
(import (
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
nodeName = lock.nodes.root.inputs.flake-compat;
|
||||
in
|
||||
fetchTarball {
|
||||
url = lock.nodes.${nodeName}.locked.url;
|
||||
sha256 = lock.nodes.${nodeName}.locked.narHash;
|
||||
}
|
||||
) { src = ./.; }).shellNix
|
||||
|
||||
Reference in New Issue
Block a user