renode: use standard nix-update-script

We can now use standard nix-update-script but the renode-unstable still
requires the custom update script so we moved it to the specific .nix
file.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
This commit is contained in:
Otavio Salvador 2024-03-27 13:21:32 -03:00
parent f085097270
commit 50612fec98
2 changed files with 25 additions and 29 deletions

View File

@ -1,11 +1,9 @@
{ renode
, fetchurl
, buildUnstable ? true
, writeScript
}:
(renode.override {
inherit buildUnstable;
}).overrideAttrs (finalAttrs: _: {
renode.overrideAttrs (finalAttrs: _: {
pname = "renode-unstable";
version = "1.15.0+20240320git97be875a3";
@ -13,4 +11,25 @@
url = "https://builds.renode.io/renode-${finalAttrs.version}.linux-portable.tar.gz";
hash = "sha256-+1tOZ44fg/Z4n4gjPylRQlRE7KnL0AGcODlue/HLb3I=";
};
passthru.updateScript =
let
versionRegex = "[0-9\.\+]+[^\+]*.";
in
writeScript "${finalAttrs.pname}-updater" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl gnugrep gnused pup
latestVersion=$(
curl -sS https://builds.renode.io \
| pup 'a text{}' \
| egrep 'renode-${versionRegex}\.linux-portable\.tar\.gz' \
| head -n1 \
| sed -e 's,renode-\(.*\)\.linux-portable\.tar\.gz,\1,g'
)
update-source-version ${finalAttrs.pname} "$latestVersion" \
--file=pkgs/by-name/re/${finalAttrs.pname}/package.nix \
--system=x86_64-linux
'';
})

View File

@ -3,13 +3,12 @@
, fetchurl
, autoPatchelfHook
, makeWrapper
, writeScript
, nix-update-script
, glibcLocales
, python3Packages
, gtk-sharp-2_0
, gtk2-x11
, screen
, buildUnstable ? false
}:
let
@ -69,29 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru.updateScript =
let
versionRegex =
if buildUnstable
then "[0-9\.\+]+[^\+]*."
else "[0-9\.]+[^\+]*.";
in
writeScript "${finalAttrs.pname}-updater" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl gnugrep gnused pup
latestVersion=$(
curl -sS https://builds.renode.io \
| pup 'a text{}' \
| egrep 'renode-${versionRegex}\.linux-portable\.tar\.gz' \
| head -n1 \
| sed -e 's,renode-\(.*\)\.linux-portable\.tar\.gz,\1,g'
)
update-source-version ${finalAttrs.pname} "$latestVersion" \
--file=pkgs/by-name/re/${finalAttrs.pname}/package.nix \
--system=x86_64-linux
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Virtual development framework for complex embedded systems";