nixpkgs/pkgs/by-name/re/renode-unstable/package.nix
Otavio Salvador 50612fec98 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>
2024-03-27 13:21:32 -03:00

36 lines
1008 B
Nix

{ renode
, fetchurl
, writeScript
}:
renode.overrideAttrs (finalAttrs: _: {
pname = "renode-unstable";
version = "1.15.0+20240320git97be875a3";
src = fetchurl {
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
'';
})