fix(rust): write cargo checksum for path dependencies

This commit is contained in:
Yusuf Bera Ertan 2022-02-10 20:30:26 +03:00
parent 2167b7e993
commit 947fb621a8
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -39,9 +39,9 @@ let
makeSource = dep:
let
path = getSource dep.name dep.version;
isGit = (getSourceSpec dep.name dep.version).type == "git";
spec = getSourceSpec dep.name dep.version;
in {
inherit path isGit dep;
inherit path spec dep;
name = "${dep.name}-${dep.version}";
};
sources = l.map makeSource deps;
@ -73,12 +73,16 @@ let
tree="$(dirname $crateCargoTOML)"
'';
makeScript = source:
let
isGit = source.spec.type == "git";
isPath = source.spec.type == "path";
in
''
tree="${source.path}"
${l.optionalString source.isGit (findCrateSource source)}
${l.optionalString isGit (findCrateSource source)}
cp -prvd "$tree" $out/${source.name}
chmod u+w $out/${source.name}
${l.optionalString source.isGit "printf '{\"files\":{},\"package\":null}' > \"$out/${source.name}/.cargo-checksum.json\""}
${l.optionalString (isGit || isPath) "printf '{\"files\":{},\"package\":null}' > \"$out/${source.name}/.cargo-checksum.json\""}
'';
in
pkgs.runCommand "vendor-${pname}-${version}" {} ''