zram-generator: add updateScript

This commit is contained in:
Nick Cao 2023-02-02 10:53:10 +08:00
parent 0cfc7e63a6
commit 4ed5e94f9d
No known key found for this signature in database
3 changed files with 24 additions and 6 deletions

View File

@ -28,9 +28,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.78"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-if"
@ -182,9 +182,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro2"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]

View File

@ -51,8 +51,11 @@ stdenv.mkDerivation rec {
"SYSTEMD_SYSTEM_GENERATOR_DIR=$(out)/lib/systemd/system-generators"
];
passthru.tests = {
inherit (nixosTests) zram-generator;
passthru = {
tests = {
inherit (nixosTests) zram-generator;
};
updateScript = ./update.sh;
};
meta = with lib; {

View File

@ -0,0 +1,15 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils curl jq common-updater-scripts cargo
# shellcheck shell=bash
set -euo pipefail
version=$(curl -s https://api.github.com/repos/systemd/zram-generator/releases/latest | jq -r .tag_name)
update-source-version zram-generator "${version#v}"
tmp=$(mktemp -d)
trap 'rm -rf -- "${tmp}"' EXIT
git clone --depth 1 --branch "${version}" https://github.com/systemd/zram-generator.git "${tmp}/zram-generator"
cargo generate-lockfile --manifest-path "${tmp}/zram-generator/Cargo.toml"
cp "${tmp}/zram-generator/Cargo.lock" "$(dirname "$0")/Cargo.lock"