nixpkgs/pkgs/games/osu-lazer/bin.nix
Peder Bergebakken Sundt 985aa8174d treewide: unbreak appimageTools.wrapType2 builds
`appimageTools.wrapType2` no longer creates a binary `$out/bin/${name}` if `pname` and `version` is provided.
Derivations that have worked around this behavior with a `mv $out/bin/{${name},${pname}}` broke as a result.
This should fix most instances.

contex: #271071
2024-04-24 15:26:52 +02:00

74 lines
2.2 KiB
Nix

{ lib
, stdenv
, fetchurl
, fetchzip
, appimageTools
}:
let
pname = "osu-lazer-bin";
version = "2024.412.1";
src = {
aarch64-darwin = fetchzip {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Apple.Silicon.zip";
hash = "sha256-iV9m6w2bs2123uUmH1lgc+sZFG0NtvEIaQmADkaF/x8=";
stripRoot = false;
};
x86_64-darwin = fetchzip {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.app.Intel.zip";
hash = "sha256-yuVoNApIp9g+Un2LHdDsvVo+BCflPT4rMPtOf1vltZA=";
stripRoot = false;
};
x86_64-linux = fetchurl {
url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage";
hash = "sha256-9mMP8+Ee8lZcaIkZfcaDmgDqe/rFvEGc01oGwFpnhOY=";
};
}.${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)";
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; [ delan gepbird spacefault stepbrobd ];
mainProgram = "osu!";
platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
};
passthru.updateScript = ./update-bin.sh;
in
if stdenv.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
''
mv -v $out/bin/${pname} $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
'';
}