cargo-c: add update script

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
Marcin Serwin
2025-07-19 14:22:03 +05:30
committed by Masum Reza
parent 50a6e5439d
commit 2d5de22889
2 changed files with 24 additions and 4 deletions
+10 -4
View File
@@ -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 = {
+14
View File
@@ -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"