-
Notifications
You must be signed in to change notification settings - Fork 55
/
default.nix
93 lines (83 loc) · 2.25 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
lib,
makeDesktopItem,
symlinkJoin,
writeShellScriptBin,
gamemode,
wine-discord-ipc-bridge,
winetricks,
wine,
wineFlags ? "",
pname ? "osu-stable",
location ? "$HOME/.osu",
tricks ? ["gdiplus" "dotnet45" "meiryo"],
preCommands ? "",
postCommands ? "",
osu-mime,
}: let
src = builtins.fetchurl rec {
url = "https://m1.ppy.sh/r/osu!install.exe";
name = "osuinstall-${lib.strings.sanitizeDerivationName sha256}.exe";
sha256 = (builtins.fromJSON (builtins.readFile ./info.json)).hash;
};
# concat winetricks args
tricksFmt = with builtins;
if (length tricks) > 0
then concatStringsSep " " tricks
else "-V";
script = writeShellScriptBin pname ''
export WINEARCH="win32"
export WINEPREFIX="${location}"
# sets realtime priority for wine
export STAGING_RT_PRIORITY_SERVER=1
# disables vsync for OpenGL
export vblank_mode=0
PATH=$PATH:${wine}/bin:${winetricks}/bin
USER="$(whoami)"
OSU="$WINEPREFIX/drive_c/osu/osu!.exe"
if [ ! -d "$WINEPREFIX" ]; then
# install tricks
winetricks -q -f ${tricksFmt}
wineserver -k
# install osu
wine ${src}
wineserver -k
mv "$WINEPREFIX/drive_c/users/$USER/AppData/Local/osu!" $WINEPREFIX/drive_c/osu
fi
${preCommands}
wine ${wine-discord-ipc-bridge}/bin/winediscordipcbridge.exe &
${gamemode}/bin/gamemoderun wine ${wineFlags} "$OSU" "$@"
wineserver -w
${postCommands}
'';
desktopItems = makeDesktopItem {
name = pname;
exec = "${script}/bin/${pname} %U";
icon = "osu!"; # icon comes from the osu-mime package
comment = "Rhythm is just a *click* away";
desktopName = "osu!stable";
categories = ["Game"];
mimeTypes = [
"application/x-osu-skin-archive"
"application/x-osu-replay"
"application/x-osu-beatmap-archive"
"x-scheme-handler/osu"
];
};
in
symlinkJoin {
name = pname;
paths = [
desktopItems
script
osu-mime
];
meta = {
description = "osu!stable installer and runner";
homepage = "https://osu.ppy.sh";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [fufexan];
passthru.updateScript = ./update.sh;
platforms = ["x86_64-linux"];
};
}