push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,137 @@
{
lib,
stdenv,
fetchurl,
makeDesktopItem,
wrapGAppsHook3,
copyDesktopItems,
imagemagick,
jdk,
jdk17,
jdk21,
hmclJdk ? jdk,
minecraftJdks ? [
jdk
jdk17
jdk21
],
xorg,
glib,
libGL,
glfw,
openal,
libglvnd,
alsa-lib,
wayland,
vulkan-loader,
libpulseaudio,
gobject-introspection,
callPackage,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "hmcl";
version = "3.6.18";
src = fetchurl {
# HMCL has built-in keys, such as the Microsoft OAuth secret and the CurseForge API key.
# See https://github.com/HMCL-dev/HMCL/blob/refs/tags/release-3.6.12/.github/workflows/gradle.yml#L26-L28
url = "https://github.com/HMCL-dev/HMCL/releases/download/release-${finalAttrs.version}/HMCL-${finalAttrs.version}.jar";
hash = "sha256-x8UcHdBYXdnTabJh2hxsknYipYNBJW2vKxJKHhryMLQ=";
};
icon = fetchurl {
url = "https://github.com/HMCL-dev/HMCL/raw/release-${finalAttrs.version}/HMCL/src/main/resources/assets/img/icon@8x.png";
hash = "sha256-1OVq4ujA2ZHboB7zEk7004kYgl9YcoM4qLq154MZMGo=";
};
dontUnpack = true;
dontWrapGApps = true;
desktopItems = [
(makeDesktopItem {
name = "HMCL";
exec = "hmcl";
icon = "hmcl";
comment = finalAttrs.meta.description;
desktopName = "HMCL";
categories = [ "Game" ];
})
];
nativeBuildInputs = [
gobject-introspection
wrapGAppsHook3
copyDesktopItems
imagemagick
];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib/hmcl}
cp $src $out/lib/hmcl/hmcl.jar
for n in 16 32 48 64 96 128 256
do
size=$n"x"$n
mkdir -p $out/share/icons/hicolor/$size/apps
magick ${finalAttrs.icon} -resize $size $out/share/icons/hicolor/$size/apps/hmcl.png
done
runHook postInstall
'';
fixupPhase =
let
libpath = lib.makeLibraryPath (
[
libGL
glfw
glib
openal
libglvnd
vulkan-loader
]
++ lib.optionals stdenv.hostPlatform.isLinux [
xorg.libX11
xorg.libXxf86vm
xorg.libXext
xorg.libXcursor
xorg.libXrandr
xorg.libXtst
libpulseaudio
wayland
alsa-lib
]
);
in
''
runHook preFixup
makeBinaryWrapper ${hmclJdk}/bin/java $out/bin/hmcl \
--add-flags "-jar $out/lib/hmcl/hmcl.jar" \
--set LD_LIBRARY_PATH ${libpath} \
--prefix PATH : "${lib.makeBinPath minecraftJdks}"\
''${gappsWrapperArgs[@]}
runHook postFixup
'';
passthru.updateScript = lib.getExe (callPackage ./update.nix { });
meta = {
homepage = "https://hmcl.huangyuhui.net";
description = "Minecraft Launcher which is multi-functional, cross-platform and popular";
changelog = "https://docs.hmcl.net/changelog/stable.html";
mainProgram = "hmcl";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
daru-san
moraxyc
];
inherit (hmclJdk.meta) platforms;
};
})

View File

@@ -0,0 +1,40 @@
{
writeShellApplication,
nix,
nix-update,
curl,
common-updater-scripts,
jq,
}:
writeShellApplication {
name = "update-hmcl";
runtimeInputs = [
curl
jq
nix
common-updater-scripts
nix-update
];
text = ''
# get old info
oldVersion=$(nix-instantiate --eval --strict -A "hmcl.version" | jq -e -r)
get_latest_release() {
curl --fail ''${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \
-s "https://api.github.com/repos/HMCL-dev/HMCL/releases/latest" | jq -r ".tag_name"
}
version=$(get_latest_release)
version="''${version#release-}"
if [[ "$oldVersion" == "$version" ]]; then
echo "Already up to date!"
exit 0
fi
nix-update hmcl --version="$version"
update-source-version hmcl --source-key=icon --ignore-same-version
'';
}