bcachefs-tools: add update script

This commit is contained in:
Madoura 2023-11-17 06:11:13 -06:00 committed by Bjørn Forsman
parent 1558b0d698
commit 64782b0571

View File

@ -18,6 +18,7 @@
, rustc
, rustPlatform
, makeWrapper
, writeScript
, fuseSupport ? false
}:
@ -77,9 +78,24 @@ stdenv.mkDerivation (finalAttrs: {
rm tests/test_fuse.py
'';
passthru.tests = {
smoke-test = nixosTests.bcachefs;
inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
passthru = {
tests = {
smoke-test = nixosTests.bcachefs;
inherit (nixosTests.installer) bcachefsSimple bcachefsEncrypted bcachefsMulti;
};
updateScript = writeScript "update-bcachefs-tools-and-cargo-lock.sh" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
res="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
-sL "https://api.github.com/repos/${finalAttrs.src.owner}/${finalAttrs.src.repo}/tags?per_page=1")"
version="$(echo $res | jq '.[0].name | split("v") | .[1]' --raw-output)"
update-source-version ${finalAttrs.pname} "$version" --ignore-same-hash
curl "https://raw.githubusercontent.com/${finalAttrs.src.owner}/${finalAttrs.src.repo}/v$version/rust-src/Cargo.lock" > \
"$(git rev-parse --show-toplevel)/pkgs/tools/filesystems/bcachefs-tools/Cargo.lock"
'';
};
enableParallelBuilding = true;