mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-30 05:57:28 +03:00
26 lines
457 B
Nix
26 lines
457 B
Nix
{ fetchurl
|
|
, urlForCargoPackage
|
|
, runCommand
|
|
}:
|
|
|
|
{ name
|
|
, version
|
|
, checksum
|
|
, source
|
|
, ...
|
|
}:
|
|
let
|
|
tarball = fetchurl {
|
|
name = "${name}-${version}";
|
|
sha256 = checksum;
|
|
url = urlForCargoPackage {
|
|
inherit name version source;
|
|
};
|
|
};
|
|
in
|
|
runCommand "cargo-package-${name}-${version}" { } ''
|
|
mkdir -p $out
|
|
tar -xzf ${tarball} -C $out --strip-components=1
|
|
echo '{"files":{}, "package":"${checksum}"}' > $out/.cargo-checksum.json
|
|
''
|