mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
109 lines
2.3 KiB
Nix
109 lines
2.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchurl
|
|
, makeDesktopItem
|
|
, wrapGAppsHook3
|
|
, copyDesktopItems
|
|
, imagemagick
|
|
, jre
|
|
, xorg
|
|
, glib
|
|
, libGL
|
|
, glfw
|
|
, openal
|
|
, libglvnd
|
|
, alsa-lib
|
|
, wayland
|
|
, libpulseaudio
|
|
, gobject-introspection
|
|
}:
|
|
|
|
let
|
|
version = "3.5.9";
|
|
icon = fetchurl {
|
|
url = "https://github.com/huanghongxun/HMCL/raw/release-${version}/HMCLauncher/HMCL/HMCL.ico";
|
|
hash = "sha256-+EYL33VAzKHOMp9iXoJaSGZfv+ymDDYIx6i/1o47Dmc=";
|
|
};
|
|
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=";
|
|
};
|
|
|
|
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
|
|
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
|
|
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
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://hmcl.huangyuhui.net";
|
|
description = "A Minecraft Launcher which is multi-functional, cross-platform and popular";
|
|
mainProgram = "hmcl";
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
|
license = licenses.gpl3Only;
|
|
maintainers = with maintainers; [ daru-san ];
|
|
inherit (jre.meta) platforms;
|
|
};
|
|
})
|