Skip to content

Commit

Permalink
legends-of-equestria: init at 2024.04.01
Browse files Browse the repository at this point in the history
  • Loading branch information
UlyssesZh committed Oct 23, 2024
1 parent 1c968d8 commit dcc47f7
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
84 changes: 84 additions & 0 deletions pkgs/by-name/le/legends-of-equestria/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
lib,
stdenv,
runCommand,
megacmd,
unzip,
makeWrapper,
steam-run,
makeDesktopItem,
copyDesktopItems,
}:

stdenv.mkDerivation rec {
pname = "legends-of-equestria";
version = "2024.04.01";

src =
runCommand "mega-loe"
{
inherit pname version;
nativeBuildInputs = [
megacmd
unzip
];
url = "https://mega.nz/file/sjAlgJhT#1xlFkMychrtjhSpW98Vb25Gqss5604DJGMjsGj73vXk";
outputHashAlgo = "sha256";
outputHash = "9Y0YWTCl2LBqAXo1pRK9OLxxYY9ZCA9eCXyFUa2u3nk=";
outputHashMode = "recursive";
}
''
export HOME=$TMPDIR
dest="$TMPDIR/mega-loe"
mkdir -p "$dest"
mega-get "$url" "$dest"
mkdir -p "$out"
unzip -d "$out" "$dest/$(ls "$dest")"
'';

dontBuild = true;
buildInputs = [ steam-run ];
nativeBuildInputs = [
makeWrapper
copyDesktopItems
];

installPhase = ''
mkdir -p $out/libexec
cp -r LoE $out/libexec
mkdir -p $out/bin
chmod +x $out/libexec/LoE/LoE.x86_64
makeWrapper ${lib.getExe steam-run} $out/bin/LoE \
--add-flags "$out/libexec/LoE/LoE.x86_64"
mkdir -p $out/share/icons/hicolor/128x128/apps
ln -s $out/libexec/LoE/LoE_Data/Resources/UnityPlayer.png \
$out/share/icons/hicolor/128x128/apps/legends-of-equestria.png
'';

passthru.updateScript = ./update.sh;

desktopItems = [
(makeDesktopItem {
name = "legends-of-equestria";
comment = meta.description;
desktopName = "Legends of Equestria";
genericName = "Legends of Equestria";
exec = "LoE";
icon = "legends-of-equestria";
categories = [ "Game" ];
})
];

meta = {
license = lib.licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers; [ ulysseszhan ];
mainProgram = "LoE";
homepage = "https://www.legendsofequestria.com";
description = "a free-to-play MMORPG";
downloadPage = "https://www.legendsofequestria.com/downloads";
};

}
17 changes: 17 additions & 0 deletions pkgs/by-name/le/legends-of-equestria/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts

set -eu -o pipefail

DOWNLOADS_PAGE_URL=https://www.legendsofequestria.com/downloads
REGEX='href="(https.+)".+Linux.+v(([0-9]+\.)+[0-9]+)'

if [[ $(curl -s $DOWNLOADS_PAGE_URL | grep -Fi Linux) =~ $REGEX ]]; then
url="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
else
echo "cannot find the latest version"
exit 1
fi

update-source-version legends-of-equestria "$version" "" "$url"

0 comments on commit dcc47f7

Please sign in to comment.