summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorYifei Sun <ysun@hey.com>2023-11-26 16:03:47 -0500
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-11-27 16:05:34 +0000
commite34b37843c7c8b0cb573cc3bff09a8d6580a4935 (patch)
treefc3b20c1f06e549c29f90465d7d4efdbcb68f1a1 /pkgs/games
parent5c9af7ee8bc8bda0c70f82f5e9ad8bf25797e5c2 (diff)
osu-lazer-bin: remove version from name
Reported-by: Lord-Valen <lord_valen@protonmail.com>
(cherry picked from commit aecd00daa62f5e707f161e0b12d2d506551bbb85)
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/osu-lazer/bin.nix90
-rwxr-xr-xpkgs/games/osu-lazer/update-bin.sh2
2 files changed, 41 insertions, 51 deletions
diff --git a/pkgs/games/osu-lazer/bin.nix b/pkgs/games/osu-lazer/bin.nix
index 95dadfee693fa..f28a702933e98 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 a2ed671f232cb..0aa5e97751b9e 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