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