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