Skip to content

Commit a61befb

Browse files
gdevelop: added update script, 5.5.229 -> 5.5.231 (#410318)
2 parents 8c71864 + b0f6bd0 commit a61befb

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

pkgs/by-name/gd/gdevelop/darwin.nix

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
pname,
77
version,
88
meta,
9+
passthru,
910
}:
1011
stdenvNoCC.mkDerivation (finalAttrs: {
11-
inherit pname version meta;
12+
inherit
13+
pname
14+
version
15+
meta
16+
passthru
17+
;
1218

1319
src = fetchurl {
1420
url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}-universal-mac.zip";
15-
hash = "sha256-0FT4JHGJKy6UapuV2tXKzWm0Esr6DPqu38PllUbUtrY=";
21+
hash = "sha256-zvPum8vTEXS0LbwBpzGNmcsm3s7u2oAJBhGYvlV1PWw=";
1622
};
1723

1824
sourceRoot = ".";

pkgs/by-name/gd/gdevelop/linux.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
version,
77
pname,
88
meta,
9+
passthru,
910
}:
1011
let
1112
src =
1213
if stdenv.hostPlatform.system == "x86_64-linux" then
1314
fetchurl {
1415
url = "https://github.com/4ian/GDevelop/releases/download/v${version}/GDevelop-5-${version}.AppImage";
15-
hash = "sha256-KV6gzPiu/45ibdzMG707vd10F6qLcm+afwJWa6WlywU=";
16+
hash = "sha256-RjpiIy4NqZ9QCevwWR6cKLobbsFjneq+Vhr/t0JfvgU=";
1617
}
1718
else
1819
throw "${pname}-${version} is not supported on ${stdenv.hostPlatform.system}";
@@ -29,6 +30,7 @@ appimageTools.wrapType2 {
2930
version
3031
src
3132
meta
33+
passthru
3234
;
3335

3436
extraInstallCommands = ''

pkgs/by-name/gd/gdevelop/package.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
...
66
}:
77
let
8-
version = "5.5.229";
8+
version = "5.5.231";
99
pname = "gdevelop";
1010
meta = {
1111
description = "Graphical Game Development Studio";
@@ -20,13 +20,15 @@ let
2020
mainProgram = "gdevelop";
2121
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
2222
};
23+
passthru.updateScript = ./update.sh;
2324
in
2425
if stdenv.hostPlatform.isDarwin then
2526
callPackage ./darwin.nix {
2627
inherit
2728
pname
2829
version
2930
meta
31+
passthru
3032
;
3133
}
3234
else
@@ -35,5 +37,6 @@ else
3537
pname
3638
version
3739
meta
40+
passthru
3841
;
3942
}

pkgs/by-name/gd/gdevelop/update.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i bash -p curl jq gnused
3+
4+
set -euo pipefail
5+
6+
cd "$(dirname "$0")" || exit 1
7+
8+
# Grab latest version from the GitHub repository
9+
LATEST_VER="$(curl --fail -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/4ian/GDevelop/releases" | jq -r '.[0].tag_name' | sed 's/^v//')"
10+
CURRENT_VER="$(grep -oP 'version = "\K[^"]+' package.nix)"
11+
12+
if [[ "$LATEST_VER" == "$CURRENT_VER" ]]; then
13+
echo "gdevelop is up-to-date"
14+
exit 0
15+
fi
16+
17+
echo "Updating gdevelop from $CURRENT_VER to $LATEST_VER"
18+
19+
# Update the version
20+
sed -i "s#version = \".*\";#version = \"$LATEST_VER\";#g" package.nix
21+
22+
# Update hashes
23+
# - Linux
24+
25+
LINUX_HASH="$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --type sha256 "https://github.com/4ian/GDevelop/releases/download/v${LATEST_VER}/GDevelop-5-${LATEST_VER}.AppImage")")"
26+
sed -i "s#hash = \".*\"#hash = \"$LINUX_HASH\"#g" linux.nix
27+
28+
# - Darwin
29+
30+
DARWIN_HASH="$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --type sha256 "https://github.com/4ian/GDevelop/releases/download/v${LATEST_VER}/GDevelop-5-${LATEST_VER}-universal-mac.zip")")"
31+
sed -i "s#hash = \".*\"#hash = \"$DARWIN_HASH\"#g" darwin.nix
32+
33+
echo "Updated gdevelop to $LATEST_VER"

0 commit comments

Comments
 (0)