erlang: add updateScript and update versions (#118831)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
David Leslie
2021-04-12 19:59:37 +02:00
committed by GitHub
co-authored by Sandro
parent a3e9412a4e
commit a7b54d9016
6 changed files with 30 additions and 10 deletions
@@ -5,6 +5,8 @@
, libGL ? null, libGLU ? null, wxGTK ? null, wxmac ? null, xorg ? null
, parallelBuild ? false
, systemd, wxSupport ? true
# updateScript deps
, writeScript, common-updater-scripts, coreutils, git
}:
{ baseName ? "erlang"
, version
@@ -103,6 +105,24 @@ in stdenv.mkDerivation ({
setupHook = ./setup-hook.sh;
passthru = {
updateScript =
let major = builtins.head (builtins.splitVersion version);
in writeScript "update.sh" ''
#!${stdenv.shell}
set -ox errexit
PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]}
latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1)
if [ "$latest" != "${version}" ]; then
nixpkgs="$(git rev-parse --show-toplevel)"
nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix"
update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file"
else
echo "${baseName}R${major} is already up-to-date"
fi
'';
};
meta = with lib; ({
homepage = "https://www.erlang.org/";
downloadPage = "https://www.erlang.org/download.html";