mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
Merge pull request #85021 from oxalica/osu
osu-lazer: init at 2020.714.0
This commit is contained in:
commit
2a740344cc
4 changed files with 1659 additions and 0 deletions
104
pkgs/games/osu-lazer/default.nix
Normal file
104
pkgs/games/osu-lazer/default.nix
Normal file
|
@ -0,0 +1,104 @@
|
|||
{ lib, stdenv, fetchFromGitHub, fetchurl, makeWrapper, makeDesktopItem, linkFarmFromDrvs
|
||||
, dotnet-sdk, dotnet-netcore, dotnetPackages
|
||||
, ffmpeg_4, alsaLib, SDL2, lttng-ust, numactl, alsaPlugins
|
||||
}:
|
||||
|
||||
let
|
||||
runtimeDeps = [
|
||||
ffmpeg_4 alsaLib SDL2 lttng-ust numactl
|
||||
];
|
||||
|
||||
# https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#using-rids
|
||||
runtimeId = "linux-x64";
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "osu-lazer";
|
||||
version = "2020.714.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ppy";
|
||||
repo = "osu";
|
||||
rev = version;
|
||||
sha256 = "1dh3krvs7mfiyyr3cjkp396zaipcibw2s45smfzr9aqrznsqx64v";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ dotnet-sdk dotnetPackages.Nuget makeWrapper ];
|
||||
|
||||
nugetDeps = linkFarmFromDrvs "${pname}-nuget-deps" (import ./deps.nix {
|
||||
fetchNuGet = { name, version, sha256 }: fetchurl {
|
||||
name = "nuget-${name}-${version}.nupkg";
|
||||
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
|
||||
inherit sha256;
|
||||
};
|
||||
});
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
nuget sources Add -Name nixos -Source "$PWD/nixos"
|
||||
nuget init "$nugetDeps" "$PWD/nixos"
|
||||
|
||||
# FIXME: https://github.com/NuGet/Home/issues/4413
|
||||
mkdir -p $HOME/.nuget/NuGet
|
||||
cp $HOME/.config/NuGet/NuGet.Config $HOME/.nuget/NuGet
|
||||
|
||||
dotnet restore --source nixos osu.Desktop
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
dotnet build osu.Desktop \
|
||||
--no-restore \
|
||||
--configuration Release \
|
||||
-p:Version=${version}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
dotnet publish osu.Desktop \
|
||||
--no-build \
|
||||
--configuration Release \
|
||||
--no-self-contained \
|
||||
--output $out/lib/osu
|
||||
shopt -s extglob
|
||||
rm -r $out/lib/osu/runtimes/!(${runtimeId})
|
||||
|
||||
makeWrapper $out/lib/osu/osu\! $out/bin/osu\! \
|
||||
--set DOTNET_ROOT "${dotnet-netcore}" \
|
||||
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}"
|
||||
for i in 16 32 48 64 96 128 256 512 1024; do
|
||||
install -D ./assets/lazer.png $out/share/icons/hicolor/''${i}x$i/apps/osu\!.png
|
||||
done
|
||||
cp -r ${makeDesktopItem {
|
||||
desktopName = "osu!";
|
||||
name = "osu";
|
||||
exec = "osu!";
|
||||
icon = "osu!";
|
||||
comment = meta.description;
|
||||
type = "Application";
|
||||
categories = "Game;";
|
||||
}}/share/applications $out/share
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# Strip breaks the executable.
|
||||
dontStrip = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Rhythm is just a *click* away";
|
||||
homepage = "https://osu.ppy.sh";
|
||||
license = with licenses; [ mit cc-by-nc-40 ];
|
||||
maintainers = with maintainers; [ oxalica ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
passthru.updateScript = ./update.sh;
|
||||
}
|
1492
pkgs/games/osu-lazer/deps.nix
generated
Normal file
1492
pkgs/games/osu-lazer/deps.nix
generated
Normal file
File diff suppressed because it is too large
Load diff
58
pkgs/games/osu-lazer/update.sh
Executable file
58
pkgs/games/osu-lazer/update.sh
Executable file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq common-updater-scripts dotnet-sdk_3
|
||||
set -eo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
deps_file="$(realpath "./deps.nix")"
|
||||
|
||||
new_version="$(curl -s "https://api.github.com/repos/ppy/osu/releases" | jq -r '.[0].name')"
|
||||
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
|
||||
if [[ "$new_version" == "$old_version" ]]; then
|
||||
echo "Up to date"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd ../../..
|
||||
update-source-version osu-lazer "$new_version"
|
||||
store_src="$(nix-build . -A osu-lazer.src --no-out-link)"
|
||||
src="$(mktemp -d /tmp/osu-src.XXX)"
|
||||
echo "Temp src dir: $src"
|
||||
cp -rT "$store_src" "$src"
|
||||
chmod -R +w "$src"
|
||||
|
||||
pushd "$src"
|
||||
|
||||
# Setup empty nuget package folder to force reinstall.
|
||||
mkdir ./nuget_tmp.packages
|
||||
cat >./nuget_tmp.config <<EOF
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<config>
|
||||
<add key="globalPackagesFolder" value="$(realpath ./nuget_tmp.packages)" />
|
||||
</config>
|
||||
</configuration>
|
||||
EOF
|
||||
|
||||
dotnet restore osu.Desktop --configfile ./nuget_tmp.config
|
||||
|
||||
echo "{ fetchNuGet }: [" >"$deps_file"
|
||||
while read pkg_spec; do
|
||||
{ read pkg_name; read pkg_version; } < <(
|
||||
# Build version part should be ignored: `3.0.0-beta2.20059.3+77df2220` -> `3.0.0-beta2.20059.3`
|
||||
sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkg_spec")
|
||||
pkg_sha256="$(nix-hash --type sha256 --flat --base32 "$(dirname "$pkg_spec")"/*.nupkg)"
|
||||
cat >>"$deps_file" <<EOF
|
||||
(fetchNuGet {
|
||||
name = "$pkg_name";
|
||||
version = "$pkg_version";
|
||||
sha256 = "$pkg_sha256";
|
||||
})
|
||||
EOF
|
||||
done < <(find ./nuget_tmp.packages -name '*.nuspec' | sort)
|
||||
echo "]" >>"$deps_file"
|
||||
|
||||
popd
|
||||
rm -r "$src"
|
|
@ -21702,6 +21702,11 @@ in
|
|||
|
||||
osmium-tool = callPackage ../applications/misc/osmium-tool { };
|
||||
|
||||
osu-lazer = callPackage ../games/osu-lazer {
|
||||
dotnet-sdk = dotnetCorePackages.sdk_3_1;
|
||||
dotnet-netcore = dotnetCorePackages.netcore_3_1;
|
||||
};
|
||||
|
||||
owamp = callPackage ../applications/networking/owamp { };
|
||||
|
||||
vivaldi = callPackage ../applications/networking/browsers/vivaldi {};
|
||||
|
|
Loading…
Reference in a new issue