diff --git a/nix/build.nix b/nix/build.nix index c01d869fdd..8abca4066a 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -67,6 +67,7 @@ let relPath = lib.removePrefix root path; topLevelIncludes = [ "crates" + "corgi-patches" "assets" "extensions" "script" @@ -79,6 +80,10 @@ let in builtins.elem firstComp topLevelIncludes; + corgiPatches = builtins.path { + path = ../corgi-patches; + name = "corgi-patches"; + }; craneLib = crane.overrideToolchain rustToolchain; gpu-lib = if withGLES then libglvnd else vulkan-loader; commonArgs = @@ -305,7 +310,20 @@ let drv; }; }; - cargoArtifacts = craneLib.buildDepsOnly commonArgs; + cargoArtifacts = craneLib.buildDepsOnly ( + builtins.removeAttrs commonArgs [ "src" ] + // { + dummySrc = craneLib.mkDummySrc { + inherit (commonArgs) src cargoLock; + # `scratch` is a local dependency of `cxx-build`, so its API is needed + # while Crane builds third-party dependencies. + extraDummyScript = '' + rm -rf $out/corgi-patches + cp --recursive ${corgiPatches} $out/corgi-patches + ''; + }; + } + ); in craneLib.buildPackage ( lib.recursiveUpdate commonArgs {