From fbe53501e6b97d3855f536566136817972a7b535 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Oct 2025 03:02:58 +0000 Subject: [PATCH 1/3] Initial plan From be7101c51129a8434e21c616261b780ad2d93444 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Oct 2025 03:06:53 +0000 Subject: [PATCH 2/3] Modularize code and extract version info to JSON Co-authored-by: ilsubyeega <37479424+ilsubyeega@users.noreply.github.com> --- darwin.nix | 32 ++++++++++++++++++ linux.nix | 41 +++++++++++++++++++++++ meta.nix | 23 +++++++++++++ package.nix | 91 +++++++++------------------------------------------- version.json | 7 ++++ 5 files changed, 119 insertions(+), 75 deletions(-) create mode 100644 darwin.nix create mode 100644 linux.nix create mode 100644 meta.nix create mode 100644 version.json diff --git a/darwin.nix b/darwin.nix new file mode 100644 index 0000000..05ba731 --- /dev/null +++ b/darwin.nix @@ -0,0 +1,32 @@ +{ + stdenvNoCC, + makeWrapper, + pname, + version, + src, + meta, + passthru, +}: + +stdenvNoCC.mkDerivation { + inherit + pname + version + src + meta + passthru + ; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + runHook preInstall + OSU_WRAPPER="$out/Applications/osu!.app/Contents" + OSU_CONTENTS="osu!.app/Contents" + mkdir -p "$OSU_WRAPPER/MacOS" + cp -r "$OSU_CONTENTS/Info.plist" "$OSU_CONTENTS/Resources" "$OSU_WRAPPER" + cp -r "osu!.app" "$OSU_WRAPPER/Resources/osu-wrapped.app" + makeWrapper "$OSU_WRAPPER/Resources/osu-wrapped.app/Contents/MacOS/osu!" "$OSU_WRAPPER/MacOS/osu!" --set OSU_EXTERNAL_UPDATE_PROVIDER 1 + runHook postInstall + ''; +} diff --git a/linux.nix b/linux.nix new file mode 100644 index 0000000..f30dc91 --- /dev/null +++ b/linux.nix @@ -0,0 +1,41 @@ +{ + lib, + appimageTools, + makeWrapper, + pname, + version, + src, + meta, + passthru, + nativeWayland ? false, +}: + +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! \ + ${lib.optionalString nativeWayland "--set SDL_VIDEODRIVER wayland"} \ + --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/meta.nix b/meta.nix new file mode 100644 index 0000000..0ce9d08 --- /dev/null +++ b/meta.nix @@ -0,0 +1,23 @@ +{ lib }: + +{ + 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 lib.licenses; [ + mit + cc-by-nc-40 + unfreeRedistributable # osu-framework contains libbass.so in repository + ]; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + maintainers = with lib.maintainers; [ + gepbird + stepbrobd + Guanran928 + ]; + mainProgram = "osu!"; + platforms = [ + "aarch64-darwin" + "x86_64-darwin" + "x86_64-linux" + ]; +} diff --git a/package.nix b/package.nix index 1931705..c1bea12 100644 --- a/package.nix +++ b/package.nix @@ -9,91 +9,32 @@ let pname = "osu-lazer-bin-tachyon"; - version = "2025.912.0"; + + # Load version information from JSON + versionData = lib.importJSON ./version.json; + version = versionData.version; src = { x86_64-linux = fetchurl { - url = "https://github.com/ppy/osu/releases/download/${version}-tachyon/osu.AppImage"; - hash = "sha256-zhKTCsg6/Fyzsy4s1xGCmPvxMS3huDNhxLUhaS6W1tE="; + url = versionData.x86_64-linux.url; + hash = versionData.x86_64-linux.hash; }; } .${stdenvNoCC.system} or (throw "osu-lazer-bin: ${stdenvNoCC.system} is unsupported."); - 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 lib.licenses; [ - mit - cc-by-nc-40 - unfreeRedistributable # osu-framework contains libbass.so in repository - ]; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - maintainers = with lib.maintainers; [ - gepbird - stepbrobd - Guanran928 - ]; - mainProgram = "osu!"; - platforms = [ - "aarch64-darwin" - "x86_64-darwin" - "x86_64-linux" - ]; - }; + # Load metadata from separate module + meta = import ./meta.nix { inherit lib; }; passthru.updateScript = ./update.sh; + + # Common arguments to pass to platform-specific builders + commonArgs = { + inherit lib stdenvNoCC appimageTools makeWrapper; + inherit pname version src meta passthru; + }; in if stdenvNoCC.hostPlatform.isDarwin then - stdenvNoCC.mkDerivation { - inherit - pname - version - src - meta - passthru - ; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - runHook preInstall - OSU_WRAPPER="$out/Applications/osu!.app/Contents" - OSU_CONTENTS="osu!.app/Contents" - mkdir -p "$OSU_WRAPPER/MacOS" - cp -r "$OSU_CONTENTS/Info.plist" "$OSU_CONTENTS/Resources" "$OSU_WRAPPER" - cp -r "osu!.app" "$OSU_WRAPPER/Resources/osu-wrapped.app" - makeWrapper "$OSU_WRAPPER/Resources/osu-wrapped.app/Contents/MacOS/osu!" "$OSU_WRAPPER/MacOS/osu!" --set OSU_EXTERNAL_UPDATE_PROVIDER 1 - runHook postInstall - ''; - } + import ./darwin.nix commonArgs 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! \ - ${lib.optionalString nativeWayland "--set SDL_VIDEODRIVER wayland"} \ - --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 - ''; - } + import ./linux.nix (commonArgs // { inherit nativeWayland; }) diff --git a/version.json b/version.json new file mode 100644 index 0000000..1c5eb00 --- /dev/null +++ b/version.json @@ -0,0 +1,7 @@ +{ + "version": "2025.912.0", + "x86_64-linux": { + "url": "https://github.com/ppy/osu/releases/download/2025.912.0-tachyon/osu.AppImage", + "hash": "sha256-zhKTCsg6/Fyzsy4s1xGCmPvxMS3huDNhxLUhaS6W1tE=" + } +} From abecd8fee874d49e2a72fcaba2272906530e9d26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Oct 2025 03:08:25 +0000 Subject: [PATCH 3/3] Address code review feedback Co-authored-by: ilsubyeega <37479424+ilsubyeega@users.noreply.github.com> --- darwin.nix | 1 + linux.nix | 2 +- package.nix | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/darwin.nix b/darwin.nix index 05ba731..2104325 100644 --- a/darwin.nix +++ b/darwin.nix @@ -1,4 +1,5 @@ { + lib, stdenvNoCC, makeWrapper, pname, diff --git a/linux.nix b/linux.nix index f30dc91..63fd94d 100644 --- a/linux.nix +++ b/linux.nix @@ -7,7 +7,7 @@ src, meta, passthru, - nativeWayland ? false, + nativeWayland, }: appimageTools.wrapType2 { diff --git a/package.nix b/package.nix index c1bea12..97bddc0 100644 --- a/package.nix +++ b/package.nix @@ -32,9 +32,10 @@ let commonArgs = { inherit lib stdenvNoCC appimageTools makeWrapper; inherit pname version src meta passthru; + nativeWayland = nativeWayland; }; in if stdenvNoCC.hostPlatform.isDarwin then import ./darwin.nix commonArgs else - import ./linux.nix (commonArgs // { inherit nativeWayland; }) + import ./linux.nix commonArgs