Skip to content

Instantly share code, notes, and snippets.

@andir
Created March 28, 2019 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andir/6a5add0469b26790bde6dcc47b56403f to your computer and use it in GitHub Desktop.
Save andir/6a5add0469b26790bde6dcc47b56403f to your computer and use it in GitHub Desktop.
with import <nixpkgs> {}; # FIXME: pin the revision
let
# there is no stable or content adressable URL for this file :(
url = https://riotgamespatcher-a.akamaihd.net/releases/live/installer/deploy/League%20of%20Legends%20installer%20NA.exe;
registry = pkgs.writeText "registry.reg" ''
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
GrabFullScreen = "Y"
[HKEY_CURRENT_USER\Software\Wine\DirectInput]
MouseWrapOverride = "enable"
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
UseGLSL = "disabled"
'';
settings = pkgs.writeText "settings.yaml" ''
install:
globals:
locale: "en_US"
region: "EUW"
'';
download = pkgs.writeScriptBin "download" ''
${pkgs.curl}/bin/curl -o installer.exe ${url}
'';
install = pkgs.writeScriptBin "install" ''
${init}
test -e installer.exe || download
wine installer.exe
'';
launch = pkgs.writeScriptBin "launch" ''
${init}
wine "''${GAMEPATH}/LeagueClient.exe"
'';
init = pkgs.writeScriptBin "init" ''
winetricks winxp
wineserver -k
regedit /S ${registry}
wineserver -k
export SETTINGS_FILE="''${GAMEPATH}Config/LeagueClientSettings.yaml"
test -e $SETTINGS_FILE || cp ${settings} "$SETTINGS_FILE"
'';
in {
shell = runCommand "run" {
nativeBuildInputs = [ wine-staging winetricks curl download launch init ];
preferLocalBuild = true;
shellHook = ''
set -ex
export WINEPREFIX=$(pwd)/wine
export GAMEPATH="$WINEPREFIX/drive_c/Riot Games/League of Legends/"
export WINEDLLOVERRIDES="msvcp140=n"
mkdir -p $WINEPREFIX
echo "run >install< to install the game."
echo "run >download< to download the installer."
echo "run >launch< to launch the games launcher."
'';
} "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment