osu-lazer-bin: 2023.301.0 -> 2023.305.0

This commit is contained in:
Delan Azabani 2023-03-07 16:26:57 +08:00 committed by StepBroBD
parent f0ea95c2c7
commit 466240f8cb
Failed to extract signature
2 changed files with 83 additions and 21 deletions

View File

@ -1,28 +1,68 @@
{ appimageTools, lib, fetchurl }:
{ lib
, stdenv
, fetchurl
, fetchzip
, appimageTools
}:
appimageTools.wrapType2 rec {
let
pname = "osu-lazer-bin";
version = "2023.301.0";
version = "2023.305.0";
name = "${pname}-${version}";
src = fetchurl {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage";
sha256 = "sha256-0c74bGOY9f2K52xE7CZy/i3OfyCC+a6XGI30c6hI7jM=";
osu-lazer-bin-src = {
aarch64-darwin = {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Apple.Silicon.zip";
sha256 = "sha256-nL5j0b4vD/tTYPPBLiMxiPWLHnP5hqco0DJ+7EZRSZY=";
};
x86_64-darwin = {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Intel.zip";
sha256 = "sha256-Er48BIzJlSzDaGb6IfhZoV62kj5GJ/rw9ifUw+ZCJkc=";
};
x86_64-linux = {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage";
sha256 = "sha256-W3XJ7HtJM5iFI8OOTTu8IBHMerZSCETHMemkoTislK8=";
};
}.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported.");
linux = appimageTools.wrapType2 rec {
inherit name pname version meta;
src = fetchurl (osu-lazer-bin-src);
extraPkgs = pkgs: with pkgs; [ icu ];
extraInstallCommands =
let contents = appimageTools.extract { inherit pname version src; };
in
''
mv -v $out/bin/${pname}-${version} $out/bin/osu\!
install -m 444 -D ${contents}/osu\!.desktop -t $out/share/applications
for i in 16 32 48 64 96 128 256 512 1024; do
install -D ${contents}/osu\!.png $out/share/icons/hicolor/''${i}x$i/apps/osu\!.png
done
'';
};
extraPkgs = pkgs: with pkgs; [ icu ];
darwin = stdenv.mkDerivation rec {
inherit name pname version meta;
extraInstallCommands =
let contents = appimageTools.extract { inherit pname version src; };
in ''
mv -v $out/bin/${pname}-${version} $out/bin/osu\!
install -m 444 -D ${contents}/osu\!.desktop -t $out/share/applications
for i in 16 32 48 64 96 128 256 512 1024; do
install -D ${contents}/osu\!.png $out/share/icons/hicolor/''${i}x$i/apps/osu\!.png
done
src = fetchzip (osu-lazer-bin-src // { stripRoot = false; });
dontBuild = true;
dontFixup = true;
installPhase = ''
runHook preInstall
APP_DIR="$out/Applications"
mkdir -p "$APP_DIR"
cp -r . "$APP_DIR"
runHook postInstall
'';
};
meta = with lib; {
description = "Rhythm is just a *click* away (AppImage version for score submission and multiplayer)";
description = "Rhythm is just a *click* away (AppImage version for score submission and multiplayer, and binary distribution for Darwin systems)";
homepage = "https://osu.ppy.sh";
license = with licenses; [
mit
@ -30,8 +70,14 @@ appimageTools.wrapType2 rec {
unfreeRedistributable # osu-framework contains libbass.so in repository
];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = [ maintainers.delan ];
maintainers = with maintainers; [ delan stepbrobd ];
mainProgram = "osu!";
platforms = [ "x86_64-linux" ];
platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
};
}
passthru.updateScript = ./update-bin.sh;
in
if stdenv.isDarwin
then darwin
else linux

View File

@ -3,7 +3,8 @@
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
deps_file="$(realpath "./deps.nix")"
deps_file="$(realpath ./deps.nix)"
bin_file="$(realpath ./bin.nix)"
new_version="$(curl -s "https://api.github.com/repos/ppy/osu/releases?per_page=1" | jq -r '.[0].name')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
@ -15,7 +16,22 @@ fi
cd ../../..
if [[ "$1" != "--deps-only" ]]; then
update-source-version osu-lazer "$new_version"
update-source-version osu-lazer "$new_version"
sed -Ei.bak '/ *version = "/s/".+"/"'"$new_version"'"/' "$bin_file"
rm "$bin_file.bak"
for pair in \
'aarch64-darwin osu.app.Apple.Silicon.zip' \
'x86_64-darwin osu.app.Intel.zip' \
'x86_64-linux osu.AppImage' \
; do
set -- $pair
nix-prefetch-url "https://github.com/ppy/osu/releases/download/$new_version/$2" | while read -r hash; do
nix --extra-experimental-features nix-command hash to-sri --type sha256 "$hash" | while read -r hash; do
sed -Ei.bak '/ *'"$1"' = "sha256-/s@".+"@"'"$hash"'"@' "$bin_file"
rm "$bin_file.bak"
done
done
done
fi
$(nix-build . -A osu-lazer.fetch-deps --no-out-link) "$deps_file"