From 98b126acbb60a384007f2e8ef60236e341817fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Wed, 9 Oct 2024 16:33:55 +0200 Subject: [PATCH] osu-lazer{,-bin}: format --- pkgs/games/osu-lazer/bin.nix | 131 ++++++++++++++++++------------- pkgs/games/osu-lazer/default.nix | 58 ++++++++------ 2 files changed, 109 insertions(+), 80 deletions(-) diff --git a/pkgs/games/osu-lazer/bin.nix b/pkgs/games/osu-lazer/bin.nix index 89ebe14cb41e..e86d9327865b 100644 --- a/pkgs/games/osu-lazer/bin.nix +++ b/pkgs/games/osu-lazer/bin.nix @@ -1,31 +1,34 @@ -{ lib -, stdenv -, fetchurl -, fetchzip -, appimageTools -, makeWrapper +{ + lib, + stdenv, + fetchurl, + fetchzip, + appimageTools, + makeWrapper, }: let pname = "osu-lazer-bin"; version = "2024.906.2"; - src = { - aarch64-darwin = fetchzip { - url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Apple.Silicon.zip"; - hash = "sha256-KyvC8gEqZvXMATxS2513X0WdlR7nF8tHS4R/TPFrHao="; - stripRoot = false; - }; - x86_64-darwin = fetchzip { - url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Intel.zip"; - hash = "sha256-ToxDZHL59YPmybvB9tsiOnFEd+FJJE4mNMfaK6btYKo="; - stripRoot = false; - }; - x86_64-linux = fetchurl { - url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage"; - hash = "sha256-zQnR3KwlE1gTWH8f+GDRBsc7Whfn9XpT1D/NLg5TtrU="; - }; - }.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); + src = + { + aarch64-darwin = fetchzip { + url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Apple.Silicon.zip"; + hash = "sha256-KyvC8gEqZvXMATxS2513X0WdlR7nF8tHS4R/TPFrHao="; + stripRoot = false; + }; + x86_64-darwin = fetchzip { + url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Intel.zip"; + hash = "sha256-ToxDZHL59YPmybvB9tsiOnFEd+FJJE4mNMfaK6btYKo="; + stripRoot = false; + }; + x86_64-linux = fetchurl { + url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage"; + hash = "sha256-zQnR3KwlE1gTWH8f+GDRBsc7Whfn9XpT1D/NLg5TtrU="; + }; + } + .${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); meta = { description = "Rhythm is just a *click* away (AppImage version for score submission and multiplayer, and binary distribution for Darwin systems)"; @@ -36,42 +39,62 @@ let unfreeRedistributable # osu-framework contains libbass.so in repository ]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - maintainers = with lib.maintainers; [ gepbird stepbrobd ]; + maintainers = with lib.maintainers; [ + gepbird + stepbrobd + ]; mainProgram = "osu!"; - platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ]; + platforms = [ + "aarch64-darwin" + "x86_64-darwin" + "x86_64-linux" + ]; }; passthru.updateScript = ./update-bin.sh; in -if stdenv.hostPlatform.isDarwin -then stdenv.mkDerivation { - inherit pname version src meta passthru; +if stdenv.hostPlatform.isDarwin 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 - '' - . ${makeWrapper}/nix-support/setup-hook - mv -v $out/bin/${pname} $out/bin/osu! - wrapProgram $out/bin/osu! \ - --set OSU_EXTERNAL_UPDATE_PROVIDER 1 - 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 + 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 + '' + . ${makeWrapper}/nix-support/setup-hook + mv -v $out/bin/${pname} $out/bin/osu! + wrapProgram $out/bin/osu! \ + --set OSU_EXTERNAL_UPDATE_PROVIDER 1 + 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/default.nix b/pkgs/games/osu-lazer/default.nix index d2826e295ed9..e240f4041abc 100644 --- a/pkgs/games/osu-lazer/default.nix +++ b/pkgs/games/osu-lazer/default.nix @@ -1,19 +1,20 @@ -{ lib -, stdenvNoCC -, buildDotnetModule -, fetchFromGitHub -, dotnetCorePackages -, makeDesktopItem -, copyDesktopItems -, makeWrapper -, ffmpeg -, alsa-lib -, SDL2 -, lttng-ust -, numactl -, libglvnd -, xorg -, udev +{ + lib, + stdenvNoCC, + buildDotnetModule, + fetchFromGitHub, + dotnetCorePackages, + makeDesktopItem, + copyDesktopItems, + makeWrapper, + ffmpeg, + alsa-lib, + SDL2, + lttng-ust, + numactl, + libglvnd, + xorg, + udev, }: buildDotnetModule rec { @@ -76,15 +77,17 @@ buildDotnetModule rec { runHook postFixup ''; - desktopItems = [(makeDesktopItem { - desktopName = "osu!"; - name = "osu"; - exec = "osu!"; - icon = "osu!"; - comment = "Rhythm is just a *click* away (no score submission or multiplayer, see osu-lazer-bin)"; - type = "Application"; - categories = [ "Game" ]; - })]; + desktopItems = [ + (makeDesktopItem { + desktopName = "osu!"; + name = "osu"; + exec = "osu!"; + icon = "osu!"; + comment = "Rhythm is just a *click* away (no score submission or multiplayer, see osu-lazer-bin)"; + type = "Application"; + categories = [ "Game" ]; + }) + ]; passthru.updateScript = ./update.sh; @@ -96,7 +99,10 @@ buildDotnetModule rec { cc-by-nc-40 unfreeRedistributable # osu-framework contains libbass.so in repository ]; - maintainers = with maintainers; [ gepbird thiagokokada ]; + maintainers = with maintainers; [ + gepbird + thiagokokada + ]; platforms = [ "x86_64-linux" ]; mainProgram = "osu!"; };