atlauncher: refactor install phase

- move working dir from `.atlauncher` to `.local/share/ATLauncher`
- remove steam-run as a dependency
- fix no-launcher-update not working when launching from CLI
This commit is contained in:
GetPsyched 2023-09-27 15:53:54 +05:30
parent 52872745ca
commit dd414eadf5
No known key found for this signature in database

View File

@ -1,4 +1,4 @@
{ copyDesktopItems, fetchurl, jre, lib, makeDesktopItem, makeWrapper, stdenv, steam-run, withSteamRun ? true, writeShellScript }:
{ copyDesktopItems, fetchurl, jre, lib, makeDesktopItem, makeWrapper, stdenv, udev, xorg }:
stdenv.mkDerivation (finalAttrs: {
pname = "atlauncher";
@ -19,33 +19,28 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [ ];
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
installPhase =
let
# hack to use steam-run along with the exec
steamrun = writeShellScript "steamrun" ''
shift
exec ${steam-run}/bin/steam-run "''$@"
'';
in
''
runHook preInstall
mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/atlauncher \
--add-flags "-jar $src --working-dir=\$HOME/.atlauncher" \
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath finalAttrs.buildInputs}" ${
lib.strings.optionalString withSteamRun ''--run "${steamrun} \\"''
}
installPhase = ''
runHook preInstall
mkdir -p $out/share/icons/hicolor/scalable/apps
cp $ICON $out/share/icons/hicolor/scalable/apps/${finalAttrs.pname}.svg
mkdir -p $out/bin $out/share/java
cp $src $out/share/java/ATLauncher.jar
runHook postInstall
'';
makeWrapper ${jre}/bin/java $out/bin/${finalAttrs.pname} \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ xorg.libXxf86vm udev ]}" \
--add-flags "-jar $out/share/java/ATLauncher.jar" \
--add-flags "--working-dir \"\''${XDG_DATA_HOME:-\$HOME/.local/share}/ATLauncher\"" \
--add-flags "--no-launcher-update"
mkdir -p $out/share/icons/hicolor/scalable/apps
cp $ICON $out/share/icons/hicolor/scalable/apps/${finalAttrs.pname}.svg
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = finalAttrs.pname;
exec = "${finalAttrs.pname} --no-launcher-update true";
exec = finalAttrs.pname;
icon = finalAttrs.pname;
desktopName = "ATLauncher";
categories = [ "Game" ];