tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
hmcl: add updateScript
Moraxyc
6 months ago
e5dcb41b
c147291a
+43
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
hm
hmcl
package.nix
update.nix
+3
pkgs/by-name/hm/hmcl/package.nix
···
26
26
vulkan-loader,
27
27
libpulseaudio,
28
28
gobject-introspection,
29
29
+
callPackage,
29
30
}:
30
31
31
32
stdenv.mkDerivation (finalAttrs: {
···
112
113
113
114
runHook postFixup
114
115
'';
116
116
+
117
117
+
passthru.updateScript = lib.getExe (callPackage ./update.nix { });
115
118
116
119
meta = {
117
120
homepage = "https://hmcl.huangyuhui.net";
+40
pkgs/by-name/hm/hmcl/update.nix
···
1
1
+
{
2
2
+
writeShellApplication,
3
3
+
nix,
4
4
+
nix-update,
5
5
+
curl,
6
6
+
common-updater-scripts,
7
7
+
jq,
8
8
+
}:
9
9
+
10
10
+
writeShellApplication {
11
11
+
name = "update-hmcl";
12
12
+
runtimeInputs = [
13
13
+
curl
14
14
+
jq
15
15
+
nix
16
16
+
common-updater-scripts
17
17
+
nix-update
18
18
+
];
19
19
+
20
20
+
text = ''
21
21
+
# get old info
22
22
+
oldVersion=$(nix-instantiate --eval --strict -A "hmcl.version" | jq -e -r)
23
23
+
24
24
+
get_latest_release() {
25
25
+
curl --fail ''${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \
26
26
+
-s "https://api.github.com/repos/HMCL-dev/HMCL/releases/latest" | jq -r ".tag_name"
27
27
+
}
28
28
+
29
29
+
version=$(get_latest_release)
30
30
+
version="''${version#release-}"
31
31
+
32
32
+
if [[ "$oldVersion" == "$version" ]]; then
33
33
+
echo "Already up to date!"
34
34
+
exit 0
35
35
+
fi
36
36
+
37
37
+
nix-update hmcl --version="$version"
38
38
+
update-source-version hmcl --source-key=icon --ignore-same-version
39
39
+
'';
40
40
+
}