spade: add updateScript

This commit is contained in:
Peder Bergebakken Sundt 2024-05-15 01:01:25 +02:00
parent d1414f543e
commit db641c704f

View File

@ -2,6 +2,9 @@
, rustPlatform
, fetchFromGitLab
, stdenv
, nix-update
, writeScript
, git
}:
rustPlatform.buildRustPackage rec {
@ -25,6 +28,18 @@ rustPlatform.buildRustPackage rec {
};
};
# rust + gitlab is a rare combo
passthru.updateScript = [
(writeScript "update-spade" ''
VERSION="$(
${lib.getExe git} ls-remote --tags --sort -version:refname ${lib.escapeShellArg src.gitRepoUrl} \
| cut -f2 | grep ^refs/tags/v | cut -d/ -f3- | cut -c2- \
| sort --version-sort --reverse | head -n1
)"
exec ${lib.getExe nix-update} --version "$VERSION" "$@"
'')
];
meta = with lib; {
description = "A better hardware description language";
homepage = "https://gitlab.com/spade-lang/spade";