Merge pull request #336704 from flokli/proc-macro-crate-CARGO

default-crate-overrides: proc-macro-crate assumes env::var("CARGO")
This commit is contained in:
Ilan Joselevich
2024-08-23 15:27:02 +03:00
committed by GitHub
@@ -43,6 +43,7 @@
, udev
, webkitgtk_4_1
, zlib
, buildPackages
, ...
}:
@@ -357,4 +358,15 @@ in
buildInputs = [ atk ];
};
# Assumes it can run Command::new(env::var("CARGO")).arg("locate-project")
# https://github.com/bkchr/proc-macro-crate/blame/master/src/lib.rs#L244
proc-macro-crate = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "2.0") {
prePatch = (attrs.prePatch or "") + ''
substituteInPlace \
src/lib.rs \
--replace-fail \
'env::var("CARGO").map_err(|_| Error::CargoEnvVariableNotSet)?' \
'"${lib.getBin buildPackages.cargo}/bin/cargo"'
'';
};
}