nixos/filesystems: don't silently ignore label when device is set (#361418)
[NixPkgs.git] / pkgs / by-name / hm / hmcl / package.nix
blob7a330c399272bfb1a7d5dbcd8008f9566b511bcf
1 { lib
2 , stdenv
3 , fetchurl
4 , makeDesktopItem
5 , wrapGAppsHook3
6 , copyDesktopItems
7 , imagemagick
8 , jre
9 , xorg
10 , glib
11 , libGL
12 , glfw
13 , openal
14 , libglvnd
15 , alsa-lib
16 , wayland
17 , libpulseaudio
18 , gobject-introspection
21 let
22   version = "3.5.9";
23   icon = fetchurl {
24     url = "https://github.com/huanghongxun/HMCL/raw/release-${version}/HMCLauncher/HMCL/HMCL.ico";
25     hash = "sha256-+EYL33VAzKHOMp9iXoJaSGZfv+ymDDYIx6i/1o47Dmc=";
26   };
28 stdenv.mkDerivation (finalAttrs: {
29   pname = "hmcl";
30   inherit version;
32   src = fetchurl {
33     url = "https://github.com/huanghongxun/HMCL/releases/download/release-${version}/HMCL-${version}.jar";
34     hash = "sha256-iaOg0OiGEdS0E7UTanZkciWDHqeZoAdBM3ghH10Wbd8=";
35   };
37   dontUnpack = true;
39   dontWrapGApps = true;
41   desktopItems = [
42     (makeDesktopItem {
43       name = "HMCL";
44       exec = "hmcl";
45       icon = "hmcl";
46       comment = finalAttrs.meta.description;
47       desktopName = "HMCL";
48       categories = [ "Game" ];
49     })
50   ];
52   nativeBuildInputs = [
53     gobject-introspection
54     wrapGAppsHook3
55     copyDesktopItems
56     imagemagick
57   ];
59   installPhase = ''
60     runHook preInstall
62     mkdir -p $out/{bin,lib/hmcl}
63     cp $src $out/lib/hmcl/hmcl.jar
64     magick ${icon} hmcl.png
65     install -Dm644 hmcl-1.png $out/share/icons/hicolor/32x32/apps/hmcl.png
67     runHook postInstall
68   '';
70     fixupPhase =
71       let
72         libpath = lib.makeLibraryPath ([
73           libGL
74           glfw
75           glib
76           openal
77           libglvnd
78         ] ++ lib.optionals stdenv.hostPlatform.isLinux [
79           xorg.libX11
80           xorg.libXxf86vm
81           xorg.libXext
82           xorg.libXcursor
83           xorg.libXrandr
84           xorg.libXtst
85           libpulseaudio
86           wayland
87           alsa-lib
88         ]);
89       in ''
90         runHook preFixup
92         makeBinaryWrapper ${jre}/bin/java $out/bin/hmcl \
93           --add-flags "-jar $out/lib/hmcl/hmcl.jar" \
94           --set LD_LIBRARY_PATH ${libpath} \
95           ''${gappsWrapperArgs[@]}
97         runHook postFixup
98       '';
100   meta = with lib; {
101     homepage = "https://hmcl.huangyuhui.net";
102     description = "A Minecraft Launcher which is multi-functional, cross-platform and popular";
103     mainProgram = "hmcl";
104     sourceProvenance = with sourceTypes; [ binaryBytecode ];
105     license = licenses.gpl3Only;
106     maintainers = with maintainers; [ daru-san ];
107     inherit (jre.meta) platforms;
108   };