2021-12-27 01:05:23 +03:00
|
|
|
{ fetchurl
|
|
|
|
, urlForCargoPackage
|
2023-09-04 03:33:25 +03:00
|
|
|
, runCommand
|
2021-12-27 01:05:23 +03:00
|
|
|
}:
|
|
|
|
|
|
|
|
{ name
|
|
|
|
, version
|
|
|
|
, checksum
|
|
|
|
, ...
|
2022-01-30 03:12:22 +03:00
|
|
|
}@args:
|
2021-12-27 01:05:23 +03:00
|
|
|
let
|
2022-11-21 03:22:13 +03:00
|
|
|
pkgInfo = urlForCargoPackage args;
|
|
|
|
tarball = fetchurl (pkgInfo.fetchurlExtraArgs // {
|
|
|
|
inherit (pkgInfo) url;
|
2021-12-27 01:05:23 +03:00
|
|
|
name = "${name}-${version}";
|
|
|
|
sha256 = checksum;
|
2022-11-21 03:22:13 +03:00
|
|
|
});
|
2021-12-27 01:05:23 +03:00
|
|
|
in
|
2023-09-04 03:33:25 +03:00
|
|
|
runCommand "cargo-package-${name}-${version}" { } ''
|
2021-12-27 01:05:23 +03:00
|
|
|
mkdir -p $out
|
|
|
|
tar -xzf ${tarball} -C $out --strip-components=1
|
|
|
|
echo '{"files":{}, "package":"${checksum}"}' > $out/.cargo-checksum.json
|
|
|
|
''
|