-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathdefault.nix
171 lines (157 loc) · 4.79 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
{
lib,
makeDesktopItem,
symlinkJoin,
writeShellScriptBin,
gamemode,
gamescope,
winetricks,
wine,
dxvk,
umu-launcher,
proton-ge-bin,
wineFlags ? "",
pname ? "star-citizen",
location ? "$HOME/Games/star-citizen",
tricks ? ["powershell" "corefonts" "tahoma"],
useUmu ? false,
protonPath ? "${proton-ge-bin.steamcompattool}/",
protonVerbs ? ["waitforexitandrun"],
wineDllOverrides ? ["winemenubuilder.exe=d"],
gameScopeEnable ? false,
gameScopeArgs ? [],
preCommands ? "",
postCommands ? "",
enableGlCache ? true,
glCacheSize ? 1073741824,
pkgs,
}: let
inherit (lib.strings) concatStringsSep optionalString;
# Latest version can be found: https://install.robertsspaceindustries.com/rel/2/latest.yml
version = "2.1.0";
src = pkgs.fetchurl {
url = "https://install.robertsspaceindustries.com/rel/2/RSI%20Launcher-Setup-${version}.exe";
name = "RSI Launcher-Setup-${version}.exe";
hash = "sha256-h/mlOMzDzY0qvEtX6zHox/qlueJZ2IHToxYnTem/V9I=";
};
# Powershell stub for star-citizen
# concat winetricks args
tricksFmt =
if (builtins.length tricks) > 0
then concatStringsSep " " tricks
else "-V";
gameScope = lib.strings.optionalString gameScopeEnable "${gamescope}/bin/gamescope ${concatStringsSep " " gameScopeArgs} --";
script = writeShellScriptBin pname ''
export WINETRICKS_LATEST_VERSION_CHECK=disabled
export WINEARCH="win64"
export WINEPREFIX="${location}"
${
optionalString
#this option doesn't work on umu, an umu TOML config file will be needed instead
(!useUmu)
''
export WINEFSYNC=1
export WINEESYNC=1
export WINEDLLOVERRIDES="${lib.strings.concatStringsSep "," wineDllOverrides}"
# Anti-cheat
export EOS_USE_ANTICHEATCLIENTNULL=1
# Nvidia tweaks
export WINE_HIDE_NVIDIA_GPU=1
# AMD
export dual_color_blend_by_location="true"
export WINEDEBUG=-all
''
}
# ID for umu, not used for now
export GAMEID="umu-starcitizen"
export STORE="none"
export __GL_SHADER_DISK_CACHE=${
if enableGlCache
then "1"
else "0"
}
export __GL_SHADER_DISK_CACHE_SIZE=${toString glCacheSize}
PATH=${
lib.makeBinPath (
if useUmu
then [umu-launcher]
else [wine winetricks]
)
}:$PATH
USER="$(whoami)"
RSI_LAUNCHER="$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/RSI Launcher/RSI Launcher.exe"
${
if useUmu
then ''
export PROTON_VERBS="${concatStringsSep "," protonVerbs}"
export PROTONPATH="${protonPath}"
if [ ! -f "$RSI_LAUNCHER" ]; then umu-run "${src}" /S; fi
''
else ''
if [ ! -d "$WINEPREFIX" ]; then
# install tricks
winetricks -q -f ${tricksFmt}
wineserver -k
mkdir -p "$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/StarCitizen/"{LIVE,PTU}
# install launcher
# Use silent install
wine ${src} /S
wineserver -k
fi
${dxvk}/bin/setup_dxvk.sh install --symlink
''
}
# EAC Fix
if [ -d "$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/EasyAntiCheat" ]
then
rm -rf "$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/EasyAntiCheat";
fi
cd $WINEPREFIX
${preCommands}
${
if useUmu
then ''
${gameScope} ${gamemode}/bin/gamemoderun umu-run "$RSI_LAUNCHER" "$@"
''
else ''
if [[ -t 1 ]]; then
${gameScope} ${gamemode}/bin/gamemoderun wine ${wineFlags} "$RSI_LAUNCHER" "$@"
else
export LOG_DIR=$(mktemp -d)
echo "Working arround known launcher error by outputting logs to $LOG_DIR"
${gameScope} ${gamemode}/bin/gamemoderun wine ${wineFlags} "$RSI_LAUNCHER" "$@" >"$LOG_DIR/RSIout" 2>"$LOG_DIR/RSIerr"
fi
wineserver -w
''
}
${postCommands}
'';
icon = pkgs.fetchurl {
# Source: https://lutris.net/games/icon/star-citizen.png
url = "https://github-production-user-asset-6210df.s3.amazonaws.com/17859309/255031314-2fac3a8d-a927-4aa9-a9ad-1c3e14466c20.png";
hash = "sha256-19A1DyLQQcXQvVi8vW/ml+epF3WRlU5jTmI4nBaARF0=";
};
desktopItems = makeDesktopItem {
name = pname;
exec = "${script}/bin/${pname} %U";
inherit icon;
comment = "Star Citizen - Alpha";
desktopName = "Star Citizen";
categories = ["Game"];
mimeTypes = ["application/x-star-citizen-launcher"];
};
in
symlinkJoin {
name = pname;
paths = [
desktopItems
script
];
meta = {
description = "Star Citizen installer and launcher";
homepage = "https://robertsspaceindustries.com/";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [fuzen];
platforms = ["x86_64-linux"];
};
}