Merge pull request #222118 from StepBroBD/osu-lazer

osu-lazer: 2023.301.0 -> 2023.305.0
This commit is contained in:
Thiago Kenji Okada 2023-03-20 19:51:07 +00:00 committed by GitHub
commit 7055ad6182
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 23 deletions

View file

@ -14301,6 +14301,16 @@
githubId = 22163194;
name = "Stel Abrego";
};
stepbrobd = {
name = "StepBroBD";
github = "StepBroBD";
githubId = 81826728;
email = "Hi@StepBroBD.com";
matrix = "@stepbrobd:matrix.org";
keys = [{
fingerprint = "5D8B FA8B 286A C2EF 6EE4 8598 F742 B72C 8926 1A51";
}];
};
stephank = {
email = "nix@stephank.nl";
matrix = "@skochen:matrix.org";

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 ''
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
'';
};
darwin = stdenv.mkDerivation rec {
inherit name pname version meta;
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

@ -17,13 +17,13 @@
buildDotnetModule rec {
pname = "osu-lazer";
version = "2023.301.0";
version = "2023.305.0";
src = fetchFromGitHub {
owner = "ppy";
repo = "osu";
rev = version;
sha256 = "sha256-SUVxe3PdUch8NYR7X4fatbmSpyYewI69usBDICcSq3s=";
sha256 = "sha256-gkAHAiTwCYXTSIHrM3WWLBLbC7S9x1cAaEhSYvtNsvQ=";
};
projectFile = "osu.Desktop/osu.Desktop.csproj";

View file

@ -0,0 +1,40 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../. -i bash -p unzip curl jq common-updater-scripts
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
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' ./bin.nix)"
if [[ "$new_version" == "$old_version" ]]; then
echo "Already up to date."
exit 0
fi
cd ../../..
echo "Updating osu-lazer-bin from $old_version to $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
echo "Prefetching binary for $1..."
prefetch_output=$(nix --extra-experimental-features nix-command store prefetch-file --json --hash-type sha256 "https://github.com/ppy/osu/releases/download/$new_version/$2")
if [[ "$1" == *"darwin"* ]]; then
store_path=$(jq -r '.storePath' <<<"$prefetch_output")
tmpdir=$(mktemp -d)
unzip -q "$store_path" -d "$tmpdir"
hash=$(nix --extra-experimental-features nix-command hash path "$tmpdir")
rm -r "$tmpdir"
else
hash=$(jq -r '.hash' <<<"$prefetch_output")
fi
echo "$1 ($2): sha256 = $hash"
sed -Ei.bak '/ *'"$1"' = /{N;N; s@("sha256-)[^;"]+@"'"$hash"'@}' "$bin_file"
rm "$bin_file.bak"
done