Unverified Commit 3b9fae22 authored by Ilan Joselevich's avatar Ilan Joselevich Committed by GitHub
Browse files

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

default-crate-overrides: proc-macro-crate assumes env::var("CARGO")
parents f084bc3b bbb42450
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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"'
    '';
  };
}