Loading pkgs/by-name/le/legends-of-equestria/package.nix +61 −29 Original line number Diff line number Diff line Loading @@ -31,6 +31,22 @@ let pname = "legends-of-equestria"; version = "2024.06.02"; description = "Free-to-play MMORPG"; srcOptions = { x86_64-linux = { url = "https://mega.nz/file/Z3oAGYDa#01EfQICR4k5BK56hWFckYKsfgdV36KoU91TvSBwKgxY"; outputHash = "vpVIaRPrZih+ydWszsBF/JgO0AXh2rF/yOpBuI+V0m4="; }; x86_64-darwin = { url = "https://mega.nz/file/p6JQUDYC#lBRUK7lmxMHh4OvEyKjfl0W1mOL2VVzAH9rXL5ViiN0"; outputHash = "bvFg4wjltiilCP1oKfgUWThcEq8tzCIP3W/eAd3SxFo="; }; aarch64-darwin = { url = "https://mega.nz/file/cvxSzZ4b#eJHLvVHz_zxBiRxGMCBcsl1gV6M6ebQf2tQbNpEqCvk"; outputHash = "1aZGuOgXTLFxwF2FcYEwKA/LRT26uiXupBoqmzq9pFM="; }; }; runtimeDeps = [ dbus.lib Loading Loading @@ -67,17 +83,19 @@ stdenv.mkDerivation { inherit pname version; src = runCommand "mega-loe" { inherit pname version; ( srcOptions.${stdenv.hostPlatform.system} // { pname = "${pname}-source"; inherit version; nativeBuildInputs = [ megacmd unzip ]; url = "https://mega.nz/file/Z3oAGYDa#01EfQICR4k5BK56hWFckYKsfgdV36KoU91TvSBwKgxY"; outputHashAlgo = "sha256"; outputHash = "vpVIaRPrZih+ydWszsBF/JgO0AXh2rF/yOpBuI+V0m4="; outputHashMode = "recursive"; } ) '' export HOME=$(mktemp -d) dest=$HOME/mega-loe Loading @@ -91,13 +109,18 @@ stdenv.mkDerivation { buildInputs = [ libgcc ]; nativeBuildInputs = [ nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems autoPatchelfHook ]; installPhase = '' installPhase = if stdenv.hostPlatform.isLinux then '' runHook preInstall loeHome=$out/lib/${pname} Loading @@ -111,6 +134,15 @@ stdenv.mkDerivation { mkdir -p $(dirname $icon) ln -s $loeHome/LoE_Data/Resources/UnityPlayer.png $icon runHook postInstall '' else '' runHook preInstall mkdir -p $out/Applications cp -r *.app $out/Applications runHook postInstall ''; Loading @@ -131,7 +163,7 @@ stdenv.mkDerivation { meta = { inherit description; license = lib.licenses.unfree; platforms = [ "x86_64-linux" ]; platforms = lib.attrNames srcOptions; maintainers = with lib.maintainers; [ ulysseszhan ]; mainProgram = "LoE"; homepage = "https://www.legendsofequestria.com"; Loading pkgs/by-name/le/legends-of-equestria/update.sh +49 −11 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #!nix-shell -i bash -p curl common-updater-scripts #!nix-shell -i bash -p curl megacmd unzip common-updater-scripts set -eu -o pipefail DOWNLOADS_PAGE_URL=https://www.legendsofequestria.com/downloads REGEX='href="(https.+)".+Linux.+v(([0-9]+\.)+[0-9]+)' ATTR=legends-of-equestria DOWNLOADS_PAGE=https://www.legendsofequestria.com/downloads OLD_VERSION=$(nix-instantiate --eval -A $ATTR.version | tr -d '"') TMP=$(mktemp -d) if [[ $(curl -s $DOWNLOADS_PAGE_URL | grep -Fi Linux) =~ $REGEX ]]; then findHash() { system=$1 url="$2" mkdir -p $TMP/$system/{download,out} oldpwd="$(pwd)" cd $TMP/$system echo "downloading to $(pwd)/download..." >&2 HOME=$TMP mega-get "$url" download >&2 echo "unzipping to $(pwd)/out..." >&2 unzip -q -d out download/*.zip nix-hash --to-sri --type sha256 $(nix-hash --type sha256 out) cd "$oldpwd" } applyUpdate() { system=$1 echo "checking for updates for $system..." >&2 systemText="$2" regex='<a href="(https.+)">'"$systemText"'</a>.+v(([0-9]+\.)+[0-9]+)' if [[ "$(curl -s $DOWNLOADS_PAGE | grep -Fi "$systemText")" =~ $regex ]]; then url="${BASH_REMATCH[1]}" version="${BASH_REMATCH[2]}" echo "$version $url" >&2 else echo "cannot find the latest version" echo "cannot find the latest version for $system" >&2 exit 1 fi if [[ $OLD_VERSION == $version ]]; then echo "already up-to-date at version $version" >&2 exit 1 fi update-source-version legends-of-equestria "$version" "" "$url" hash="$(findHash $system "$url" | sed -E 's/sha256-(.+)/\1/')" echo "output hash: $hash" >&2 update-source-version $ATTR $version "$hash" "$url" --system=$system --ignore-same-version --ignore-same-hash } applyUpdate x86_64-linux Linux applyUpdate x86_64-darwin macOS applyUpdate aarch64-darwin "macOS arm64" Loading
pkgs/by-name/le/legends-of-equestria/package.nix +61 −29 Original line number Diff line number Diff line Loading @@ -31,6 +31,22 @@ let pname = "legends-of-equestria"; version = "2024.06.02"; description = "Free-to-play MMORPG"; srcOptions = { x86_64-linux = { url = "https://mega.nz/file/Z3oAGYDa#01EfQICR4k5BK56hWFckYKsfgdV36KoU91TvSBwKgxY"; outputHash = "vpVIaRPrZih+ydWszsBF/JgO0AXh2rF/yOpBuI+V0m4="; }; x86_64-darwin = { url = "https://mega.nz/file/p6JQUDYC#lBRUK7lmxMHh4OvEyKjfl0W1mOL2VVzAH9rXL5ViiN0"; outputHash = "bvFg4wjltiilCP1oKfgUWThcEq8tzCIP3W/eAd3SxFo="; }; aarch64-darwin = { url = "https://mega.nz/file/cvxSzZ4b#eJHLvVHz_zxBiRxGMCBcsl1gV6M6ebQf2tQbNpEqCvk"; outputHash = "1aZGuOgXTLFxwF2FcYEwKA/LRT26uiXupBoqmzq9pFM="; }; }; runtimeDeps = [ dbus.lib Loading Loading @@ -67,17 +83,19 @@ stdenv.mkDerivation { inherit pname version; src = runCommand "mega-loe" { inherit pname version; ( srcOptions.${stdenv.hostPlatform.system} // { pname = "${pname}-source"; inherit version; nativeBuildInputs = [ megacmd unzip ]; url = "https://mega.nz/file/Z3oAGYDa#01EfQICR4k5BK56hWFckYKsfgdV36KoU91TvSBwKgxY"; outputHashAlgo = "sha256"; outputHash = "vpVIaRPrZih+ydWszsBF/JgO0AXh2rF/yOpBuI+V0m4="; outputHashMode = "recursive"; } ) '' export HOME=$(mktemp -d) dest=$HOME/mega-loe Loading @@ -91,13 +109,18 @@ stdenv.mkDerivation { buildInputs = [ libgcc ]; nativeBuildInputs = [ nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems autoPatchelfHook ]; installPhase = '' installPhase = if stdenv.hostPlatform.isLinux then '' runHook preInstall loeHome=$out/lib/${pname} Loading @@ -111,6 +134,15 @@ stdenv.mkDerivation { mkdir -p $(dirname $icon) ln -s $loeHome/LoE_Data/Resources/UnityPlayer.png $icon runHook postInstall '' else '' runHook preInstall mkdir -p $out/Applications cp -r *.app $out/Applications runHook postInstall ''; Loading @@ -131,7 +163,7 @@ stdenv.mkDerivation { meta = { inherit description; license = lib.licenses.unfree; platforms = [ "x86_64-linux" ]; platforms = lib.attrNames srcOptions; maintainers = with lib.maintainers; [ ulysseszhan ]; mainProgram = "LoE"; homepage = "https://www.legendsofequestria.com"; Loading
pkgs/by-name/le/legends-of-equestria/update.sh +49 −11 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #!nix-shell -i bash -p curl common-updater-scripts #!nix-shell -i bash -p curl megacmd unzip common-updater-scripts set -eu -o pipefail DOWNLOADS_PAGE_URL=https://www.legendsofequestria.com/downloads REGEX='href="(https.+)".+Linux.+v(([0-9]+\.)+[0-9]+)' ATTR=legends-of-equestria DOWNLOADS_PAGE=https://www.legendsofequestria.com/downloads OLD_VERSION=$(nix-instantiate --eval -A $ATTR.version | tr -d '"') TMP=$(mktemp -d) if [[ $(curl -s $DOWNLOADS_PAGE_URL | grep -Fi Linux) =~ $REGEX ]]; then findHash() { system=$1 url="$2" mkdir -p $TMP/$system/{download,out} oldpwd="$(pwd)" cd $TMP/$system echo "downloading to $(pwd)/download..." >&2 HOME=$TMP mega-get "$url" download >&2 echo "unzipping to $(pwd)/out..." >&2 unzip -q -d out download/*.zip nix-hash --to-sri --type sha256 $(nix-hash --type sha256 out) cd "$oldpwd" } applyUpdate() { system=$1 echo "checking for updates for $system..." >&2 systemText="$2" regex='<a href="(https.+)">'"$systemText"'</a>.+v(([0-9]+\.)+[0-9]+)' if [[ "$(curl -s $DOWNLOADS_PAGE | grep -Fi "$systemText")" =~ $regex ]]; then url="${BASH_REMATCH[1]}" version="${BASH_REMATCH[2]}" echo "$version $url" >&2 else echo "cannot find the latest version" echo "cannot find the latest version for $system" >&2 exit 1 fi if [[ $OLD_VERSION == $version ]]; then echo "already up-to-date at version $version" >&2 exit 1 fi update-source-version legends-of-equestria "$version" "" "$url" hash="$(findHash $system "$url" | sed -E 's/sha256-(.+)/\1/')" echo "output hash: $hash" >&2 update-source-version $ATTR $version "$hash" "$url" --system=$system --ignore-same-version --ignore-same-hash } applyUpdate x86_64-linux Linux applyUpdate x86_64-darwin macOS applyUpdate aarch64-darwin "macOS arm64"