-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathdefault.nix
134 lines (121 loc) · 3.15 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
lib,
makeDesktopItem,
symlinkJoin,
writeShellScriptBin,
gamemode,
wine-discord-ipc-bridge,
winetricks,
wine,
umu,
proton-osu-bin,
wineFlags ? "",
pname ? "osu-stable",
location ? "$HOME/.osu",
useUmu ? false,
protonPath ? "${proton-osu-bin.steamcompattool}",
protonVerbs ? ["waitforexitandrun"],
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
# ID for umu
export GAMEID="osu-wine-umu"
export STORE="none"
PATH=${
lib.makeBinPath (
if useUmu
then [umu]
else [wine winetricks]
)
}:$PATH
USER="$(whoami)"
OSU="$WINEPREFIX/drive_c/osu/osu!.exe"
${
if useUmu
then ''
export PROTON_VERBS="${lib.strings.concatStringsSep "," protonVerbs}"
export PROTONPATH="${protonPath}"
if [ ! -d "$WINEPREFIX" ]; then
umu-run winetricks ${tricksFmt}
fi
if [ ! -f "$OSU" ]; then
umu-run ${src}
mv "$WINEPREFIX/drive_c/users/steamuser/AppData/Local/osu!" $WINEPREFIX/drive_c/osu
fi
''
else ''
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}
${
if useUmu
then ''
${gamemode}/bin/gamemoderun umu-run "$OSU" "$@"
''
else ''
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"];
};
}