nixpkgs/pkgs/by-name/hm/hmcl/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
2.3 KiB
Nix
Raw Permalink Normal View History

2023-07-31 03:03:00 -06:00
{ lib
, stdenv
, fetchurl
, makeDesktopItem
, wrapGAppsHook3
2023-07-31 03:03:00 -06:00
, copyDesktopItems
, imagemagick
, jre
, xorg
, glib
2023-07-31 03:03:00 -06:00
, libGL
, glfw
, openal
, libglvnd
, alsa-lib
, wayland
, libpulseaudio
2024-06-20 21:35:52 -06:00
, gobject-introspection
2023-07-31 03:03:00 -06:00
}:
let
version = "3.5.9";
2023-07-31 03:03:00 -06:00
icon = fetchurl {
url = "https://github.com/huanghongxun/HMCL/raw/release-${version}/HMCLauncher/HMCL/HMCL.ico";
2024-05-13 21:56:05 -06:00
hash = "sha256-+EYL33VAzKHOMp9iXoJaSGZfv+ymDDYIx6i/1o47Dmc=";
2023-07-31 03:03:00 -06:00
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "hmcl";
inherit version;
src = fetchurl {
url = "https://github.com/huanghongxun/HMCL/releases/download/release-${version}/HMCL-${version}.jar";
hash = "sha256-iaOg0OiGEdS0E7UTanZkciWDHqeZoAdBM3ghH10Wbd8=";
2023-07-31 03:03:00 -06:00
};
dontUnpack = true;
dontWrapGApps = true;
desktopItems = [
(makeDesktopItem {
name = "HMCL";
exec = "hmcl";
icon = "hmcl";
comment = finalAttrs.meta.description;
desktopName = "HMCL";
categories = [ "Game" ];
})
];
nativeBuildInputs = [
2024-06-20 21:35:52 -06:00
gobject-introspection
wrapGAppsHook3
2023-07-31 03:03:00 -06:00
copyDesktopItems
imagemagick
];
2024-06-20 21:35:52 -06:00
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib/hmcl}
cp $src $out/lib/hmcl/hmcl.jar
magick ${icon} hmcl.png
install -Dm644 hmcl-1.png $out/share/icons/hicolor/32x32/apps/hmcl.png
runHook postInstall
'';
fixupPhase =
let
libpath = lib.makeLibraryPath ([
libGL
glfw
glib
2024-06-20 21:35:52 -06:00
openal
libglvnd
] ++ 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 ${jre}/bin/java $out/bin/hmcl \
--add-flags "-jar $out/lib/hmcl/hmcl.jar" \
--set LD_LIBRARY_PATH ${libpath} \
''${gappsWrapperArgs[@]}
runHook postFixup
'';
2023-07-31 03:03:00 -06:00
meta = with lib; {
homepage = "https://hmcl.huangyuhui.net";
description = "A Minecraft Launcher which is multi-functional, cross-platform and popular";
mainProgram = "hmcl";
2023-07-31 03:03:00 -06:00
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.gpl3Only;
2024-05-13 21:56:20 -06:00
maintainers = with maintainers; [ daru-san ];
2023-07-31 03:03:00 -06:00
inherit (jre.meta) platforms;
};
})