diff --git a/default.nix b/default.nix index df2932f..3e5647d 100644 --- a/default.nix +++ b/default.nix @@ -52,9 +52,9 @@ let script = pkgs.writeShellScriptBin binName '' #sane bash - set -eo pipefail + set -eo pipefail - function installPrefix () { + function installPrefix () { if [ ! -d "$WINEPREFIX" ]; then ${winePkg}/bin/wineboot -i #set win 10 @@ -90,17 +90,17 @@ let ${lib.concatMapStrings (x: "${regEdit} " + x + "\n") registryFiles} fi - } + } - function installLauncher () { + function installLauncher () { installPrefix #install the launcher echo "Install with default parameters, launcherArgs won't be used when you launch the launcher from the setup" ${winePkg}/bin/wine ${rsiInstaller} - } + } - function runGame () { + function runGame () { installPrefix #install the launcher conditionally here and not in the launcher to allow force reinstalls. @@ -112,45 +112,45 @@ let ${if virtualDesktop != null then "explorer /desktop=${binName},${virtualDesktop}" else ""} \ "$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/RSI Launcher/RSI Launcher.exe" \ ${lib.concatStringsSep " " launcherArgs} - } + } - function printPrefix () { + function printPrefix () { echo "$WINEPREFIX" - } + } - function clean () { + function clean () { find "${prefixBaseDir}" -maxdepth 1 -type d -name ????????????????????????????????-"${binName}" -and -not -wholename "$WINEPREFIX" -delete - } + } - function removePrefix () { + function removePrefix () { #Good thing the GPL contains a no warranty clause rm -rf "$WINEPREFIX" - } + } - function help () { + function help () { cat ${helpText.text} - } + } - function wine () { + function wine () { installPrefix ${winePkg}/bin/"$@" - } + } #base setup - if [ ! -d "${installDir}" ]; then + if [ ! -d "${installDir}" ]; then mkdir -p "${installDir}/Roberts Space Industries" - fi + fi #create base dir for nix installs - if [ ! -d ${prefixBaseDir} ]; then + if [ ! -d ${prefixBaseDir} ]; then mkdir -p "${prefixBaseDir}" - fi + fi #core idea: Generate UUID from storage path of this script, ensure #new prefix for any changes. Needs fast prefix installs and state outside. - uuid=$(basename $(${pkgs.nix}/bin/nix path-info "$BASH_SOURCE")) - export WINEPREFIX="${prefixBaseDir}/$uuid" + uuid=$(basename $(${pkgs.nix}/bin/nix path-info "$BASH_SOURCE")) + export WINEPREFIX="${prefixBaseDir}/$uuid" #export all global env vars ${lib.concatMapStrings (x: "export " + x + "\n") (wineGlobalEnv @@ -158,7 +158,7 @@ let )} #parse input - case "$@" in + case "$@" in --install-prefix) installPrefix ;; @@ -187,7 +187,7 @@ let *) help exit 1 - esac - ''; + esac + ''; in script