diff options
| author | Nick Cao <nickcao@nichi.co> | 2023-11-28 09:20:20 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 09:20:20 -0500 |
| commit | c130043cf7e2a8394e6e077861e4f44319ce0298 (patch) | |
| tree | b2cb1d7975303e4fed04490e579e064526534a6b | |
| parent | Merge pull request #270629 from NixOS/backport-270438-to-release-23.11 (diff) | |
| parent | osu-lazer-bin: remove version from name (diff) | |
| download | nixpkgs-c130043cf7e2a8394e6e077861e4f44319ce0298.tar.gz | |
Merge pull request #270441 from NixOS/backport-270259-to-release-23.11
[Backport release-23.11] osu-lazer-bin: remove version from name
| -rw-r--r-- | pkgs/games/osu-lazer/bin.nix | 90 | ||||
| -rwxr-xr-x | pkgs/games/osu-lazer/update-bin.sh | 2 |
2 files changed, 41 insertions, 51 deletions
diff --git a/pkgs/games/osu-lazer/bin.nix b/pkgs/games/osu-lazer/bin.nix index 95dadfee693f..f28a702933e9 100644 --- a/pkgs/games/osu-lazer/bin.nix +++ b/pkgs/games/osu-lazer/bin.nix @@ -8,69 +8,34 @@ let pname = "osu-lazer-bin"; version = "2023.1114.1"; - name = "${pname}-${version}"; - osu-lazer-bin-src = { - aarch64-darwin = { + src = { + aarch64-darwin = fetchzip { url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Apple.Silicon.zip"; - sha256 = "sha256-MQkHbodSkAQQpjaBP+Q35afcCrgcie6UoUldc+vjRA0="; + hash = "sha256-MQkHbodSkAQQpjaBP+Q35afcCrgcie6UoUldc+vjRA0="; + stripRoot = false; }; - x86_64-darwin = { + x86_64-darwin = fetchzip { url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Intel.zip"; - sha256 = "sha256-40ylXbn9jV9v+ve1hFwhT5/jhzNfWHjL2WIplVUD2qk="; + hash = "sha256-40ylXbn9jV9v+ve1hFwhT5/jhzNfWHjL2WIplVUD2qk="; + stripRoot = false; }; - x86_64-linux = { + x86_64-linux = fetchurl { url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage"; - sha256 = "sha256-Q2z2Js0Zc9nvyQNxzLuuV7TcwiNIRo+RMRER6ZYgh74="; + hash = "sha256-Q2z2Js0Zc9nvyQNxzLuuV7TcwiNIRo+RMRER6ZYgh74="; }; }.${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 - ''; - }; - - 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; { + meta = { 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; [ + license = with lib.licenses; [ mit cc-by-nc-40 unfreeRedistributable # osu-framework contains libbass.so in repository ]; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - maintainers = with maintainers; [ delan stepbrobd spacefault ]; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + maintainers = with lib.maintainers; [ delan spacefault stepbrobd ]; mainProgram = "osu!"; platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ]; }; @@ -78,6 +43,31 @@ let passthru.updateScript = ./update-bin.sh; in if stdenv.isDarwin -then darwin -else linux +then stdenv.mkDerivation { + inherit pname version src meta passthru; + installPhase = '' + runHook preInstall + APP_DIR="$out/Applications" + mkdir -p "$APP_DIR" + cp -r . "$APP_DIR" + runHook postInstall + ''; +} +else appimageTools.wrapType2 { + inherit pname version src meta passthru; + + 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 + ''; +} diff --git a/pkgs/games/osu-lazer/update-bin.sh b/pkgs/games/osu-lazer/update-bin.sh index a2ed671f232c..0aa5e97751b9 100755 --- a/pkgs/games/osu-lazer/update-bin.sh +++ b/pkgs/games/osu-lazer/update-bin.sh @@ -34,7 +34,7 @@ for pair in \ else hash=$(jq -r '.hash' <<<"$prefetch_output") fi - echo "$1 ($2): sha256 = $hash" + echo "$1 ($2): hash = $hash" sed -Ei.bak '/ *'"$1"' = /{N;N; s@("sha256-)[^;"]+@"'"$hash"'@}' "$bin_file" rm "$bin_file.bak" done |
