Minor refactor and Readme touchup.

This commit is contained in:
Philipp 2021-07-27 21:42:48 +02:00
parent 779c30280f
commit 3858074a34
No known key found for this signature in database
GPG key ID: 2258EE3B85DE1748
2 changed files with 26 additions and 14 deletions

View file

@ -1,4 +1,7 @@
# Idea # Nixcitizen
A [Star Citizen](https://robertsspaceindustries.com/star-citizen) runtime environment managed by nix.
## Idea
Nixcitizen is an attempt to package a wine application in a sensible and Nixcitizen is an attempt to package a wine application in a sensible and
practical way with nix. The idea that the `WINEPREFIX` is handled by a practical way with nix. The idea that the `WINEPREFIX` is handled by a
script that lives inside the nix store which derives the `WINEPREFIX` from script that lives inside the nix store which derives the `WINEPREFIX` from
@ -19,18 +22,18 @@ All dependencies are handled by wine. [dxvk](https://github.com/doitsujin/dxvk)
is compiled with nix and copied into each prefix and fonts are handled in a is compiled with nix and copied into each prefix and fonts are handled in a
similar manner similar manner
# Installation ## Installation
First clone this repository, then First clone this repository, then
## On nixos ### On nixos
* Put `(pkgs.callPackage ./path/to/repo { })` into `environment.systemPackages` or * Put `(pkgs.callPackage ./path/to/repo { })` into `environment.systemPackages` or
`users.extraUsers.<name>.packages` or into your home-manager configuration packages `users.extraUsers.<name>.packages` or into your home-manager configuration packages
## with nix-env ### with nix-build
* plz no! * `nix-build -E 'with import <nixpkgs> {}; pkgs.callPackage ./default.nix { }'
## Installation parameters ### Installation parameters
* `installDir`: Contains the `Roberts Space Industries` folder that is being linked * `installDir`: Contains the `Roberts Space Industries` folder that is being linked
into the `Program Files` folder of the prefixs. into the `Program Files` folder of the prefixs.
* `launcherCache`: `AppData` folder of the launcher. Holds the session data. * `launcherCache`: `AppData` folder of the launcher. Holds the session data.
@ -38,6 +41,8 @@ into the `Program Files` folder of the prefixs.
* `binName`: Name of the generated executable. * `binName`: Name of the generated executable.
* `launcherArgs`: Arguments the RSI Launcher is called with. * `launcherArgs`: Arguments the RSI Launcher is called with.
* `vulkanDrivers`: Force list of vulkan drivers. Supported Elements: `radeon`, `intel` and `amdvlk` * `vulkanDrivers`: Force list of vulkan drivers. Supported Elements: `radeon`, `intel` and `amdvlk`
might solve issues with mesa version conflicts mainly on non-nixos platforms. Nvidia drivers not
(yet?) supported for this option.
* `winePackage`: Package of wine to use. * `winePackage`: Package of wine to use.
* `wineSrc`: Points to the source to build wine from. * `wineSrc`: Points to the source to build wine from.
* `wineGlobalEnv`: Global variables that are exported at script startup. * `wineGlobalEnv`: Global variables that are exported at script startup.
@ -50,7 +55,7 @@ into the `Program Files` folder of the prefixs.
* `enableGameScope`: Whether or not to run the game in [gamescope](https://github.com/Plagman/gamescope). * `enableGameScope`: Whether or not to run the game in [gamescope](https://github.com/Plagman/gamescope).
* `gameScopeArgs`: [options](https://github.com/Plagman/gamescope#options) for gamescope. * `gameScopeArgs`: [options](https://github.com/Plagman/gamescope#options) for gamescope.
## Script parameters ### Script parameters
* `--install-prefix`: Installs the prefix if needed. * `--install-prefix`: Installs the prefix if needed.
* `--install-launcher`: Installs the launcher. Can be used to reinstall. * `--install-launcher`: Installs the launcher. Can be used to reinstall.
* `--clean`: Deletes all but the currently used prefixes of the game. * `--clean`: Deletes all but the currently used prefixes of the game.
@ -61,7 +66,7 @@ into the `Program Files` folder of the prefixs.
* `--wine`: Runs a wine executable inside the context of the script. Example: * `--wine`: Runs a wine executable inside the context of the script. Example:
`starcitizen --wine winecfg` `starcitizen --wine winecfg`
# Disclaimer ## Disclaimer
This repository does not host any copyrighted content. All content is fetched This repository does not host any copyrighted content. All content is fetched
from official sources and is never redistributed by the author of this from official sources and is never redistributed by the author of this
software. It does not help in any way to cheat or pirate the game. A normal software. It does not help in any way to cheat or pirate the game. A normal

View file

@ -43,21 +43,21 @@ let
patches = (if wineSrc == null then attrs.patches else []) ++ winePatches ++ lib.optional applyReccomendedWinePatches wineReccomendedPatches; patches = (if wineSrc == null then attrs.patches else []) ++ winePatches ++ lib.optional applyReccomendedWinePatches wineReccomendedPatches;
src = if wineSrc != null then wineSrc else attrs.src; src = if wineSrc != null then wineSrc else attrs.src;
}); });
dxvk = (pkgsCross.mingwW64.callPackage ./dxvk.nix { async = dxvkAsync; }).overrideAttrs dxvk = (pkgsCross.mingwW64.callPackage ./dxvk.nix { async = dxvkAsync; }).overrideAttrs
( attrs: { patches = attrs.patches ++ dxvkPatches; }); ( attrs: { patches = attrs.patches ++ dxvkPatches; });
dxvkAsyncEnv = "DXVK_ASYNC=1" ; dxvkAsyncEnv = "DXVK_ASYNC=1" ;
gamescope = "${pkgs.callPackage ./gamescope.nix {}}/bin/gamescope"; gamescope = "${pkgs.callPackage ./gamescope.nix {}}/bin/gamescope";
vulkanDriverPaths = { vulkanDriverPaths = {
radeon = "${pkgs.mesa_drivers.drivers}/share/vulkan/icd.d/radeon_icd.x86_64.json"; radeon = "${pkgs.mesa_drivers.drivers}/share/vulkan/icd.d/radeon_icd.x86_64.json";
intel = "${pkgs.mesa_drivers.drivers}/share/vulkan/icd.d/intel_icd.x86_64.json"; intel = "${pkgs.mesa_drivers.drivers}/share/vulkan/icd.d/intel_icd.x86_64.json";
amdvlk = "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json"; amdvlk = "${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json";
}; };
vkIcd = lib.strings.concatStringsSep ":" (lib.attrsets.attrVals vulkanDrivers vulkanDriverPaths); vkIcd = lib.strings.concatStringsSep ":" (lib.attrsets.attrVals vulkanDrivers vulkanDriverPaths);
fonts = pkgs.callPackage ./fonts.nix {}; fonts = pkgs.callPackage ./fonts.nix {};
wine64 = "${winePkg}/bin/wine64";
wineMulti = "${winePkg}/bin/wine";
regEdit = "${wine64} regedit";
reg = "${wine64} reg";
rsiInstaller = fetchurl { rsiInstaller = fetchurl {
url = "https://install.robertsspaceindustries.com/star-citizen/RSI-Setup-1.4.11.exe"; url = "https://install.robertsspaceindustries.com/star-citizen/RSI-Setup-1.4.11.exe";
sha256 = "1afc4b36dd1e22d75df8da2ecb925833f9b10327c991be20e138503cde627022"; sha256 = "1afc4b36dd1e22d75df8da2ecb925833f9b10327c991be20e138503cde627022";
@ -66,6 +66,7 @@ let
url = "https://aka.ms/vs/16/release/vc_redist.x86.exe"; url = "https://aka.ms/vs/16/release/vc_redist.x86.exe";
sha256 = "1p22ibzx80zn2gxavmcsz7adkr5672smmlwgapfvx6a04f9n7a7k"; sha256 = "1p22ibzx80zn2gxavmcsz7adkr5672smmlwgapfvx6a04f9n7a7k";
}; };
win10Reg = pkgs.writeTextFile { win10Reg = pkgs.writeTextFile {
name = "win10.reg"; name = "win10.reg";
text = ./win10.reg; text = ./win10.reg;
@ -74,11 +75,17 @@ let
name = "captureMouse.reg"; name = "captureMouse.reg";
text = ./captureMouse.reg; text = ./captureMouse.reg;
}; };
helpText = pkgs.writeTextFile { helpText = pkgs.writeTextFile {
name = "scHelptext"; name = "scHelptext";
text = ./helpText.txt; text = ./helpText.txt;
}; };
wine64 = "${winePkg}/bin/wine64";
wineMulti = "${winePkg}/bin/wine";
regEdit = "${wine64} regedit";
reg = "${wine64} reg";
script = pkgs.writeShellScriptBin binName '' script = pkgs.writeShellScriptBin binName ''
#sane bash #sane bash
set -eo pipefail set -eo pipefail
@ -140,7 +147,7 @@ let
fi fi
${lib.optionalString enableGameScope "${gamescope} ${builtins.concatStringsSep " " gameScopeArgs} --\\" } ${lib.optionalString enableGameScope "${gamescope} ${builtins.concatStringsSep " " gameScopeArgs} --\\" }
${wineMulti} \ ${wineMulti} \
${if virtualDesktop != null then "explorer /desktop=${binName},${virtualDesktop}" else ""} \ ${lib.optionalString (virtualDesktop != null) "explorer /desktop=${binName},${virtualDesktop}"} \
"$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/RSI Launcher/RSI Launcher.exe" \ "$WINEPREFIX/drive_c/Program Files/Roberts Space Industries/RSI Launcher/RSI Launcher.exe" \
${lib.concatStringsSep " " launcherArgs} ${lib.concatStringsSep " " launcherArgs}
} }