cargo-c: add update script
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
committed by
Masum Reza
parent
50a6e5439d
commit
2d5de22889
@@ -10,14 +10,17 @@
|
||||
rav1e,
|
||||
}:
|
||||
|
||||
let
|
||||
# this version may need to be updated along with package version
|
||||
cargoVersion = "0.80.0";
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "cargo-c";
|
||||
version = "0.10.2";
|
||||
|
||||
src = fetchCrate {
|
||||
inherit pname;
|
||||
# this version may need to be updated along with package version
|
||||
version = "${version}+cargo-0.80.0";
|
||||
version = "${version}+cargo-${cargoVersion}";
|
||||
hash = "sha256-ltxd4n3oo8ZF/G/zmR4FSVtNOkxwCjDv6PdxkmWxZ+8=";
|
||||
};
|
||||
|
||||
@@ -47,8 +50,11 @@ rustPlatform.buildRustPackage rec {
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
inherit rav1e;
|
||||
passthru = {
|
||||
tests = {
|
||||
inherit rav1e;
|
||||
};
|
||||
updateScript.command = [ ./update.sh ];
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash curl coreutils nix-update jq
|
||||
|
||||
set -ex
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
|
||||
latestVersion=`curl https://crates.io/api/v1/crates/cargo-c/versions | jq '.versions[0].num | split("+cargo-")'`
|
||||
crateVersion=`jq -r '.[0]' <<< $latestVersion`
|
||||
cargoVersion=`jq -r '.[1]' <<< $latestVersion`
|
||||
|
||||
sed -E -i "s/(cargoVersion = ).*;/\1\"$cargoVersion\";/" $SCRIPT_DIR/package.nix
|
||||
|
||||
nix-update cargo-c --version="$crateVersion"
|
||||
Reference in New Issue
Block a user