dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

cyberpunk-2077.nix (6742B)


      1 {
      2   fetchzip,
      3   symlinkJoin,
      4   writeShellApplication,
      5   writeText,
      6   writeTextDir,
      7 }:
      8 let
      9   mods = symlinkJoin {
     10     name = "cyberpunk-2077-mods";
     11     paths = [
     12       (fetchzip {
     13         url = "https://github.com/jackhumbert/let_there_be_flight/releases/download/v0.3.17/let_there_be_flight_v0.3.17.zip";
     14         hash = "sha256-FJt67+GvHHuUnqFCriHcCmR1FmuhOks0/q+NX/5NMEo=";
     15         stripRoot = false;
     16       })
     17       (fetchzip {
     18         url = "https://github.com/psiberx/cp2077-archive-xl/releases/download/v1.26.2/ArchiveXL-1.26.2.zip";
     19         hash = "sha256-Wv1neeovyRULJDb3RotTp9G7IbRfOrlapGfpsUVOgyk=";
     20         stripRoot = false;
     21       })
     22       (fetchzip {
     23         url = "https://github.com/psiberx/cp2077-tweak-xl/releases/download/v1.11.3/TweakXL-1.11.3.zip";
     24         hash = "sha256-QotqOBPoro1DHa6cL+NDYpoiXduXltAoEl0utIGNlDc=";
     25         stripRoot = false;
     26       })
     27       (fetchzip {
     28         url = "https://github.com/jackhumbert/cyberpunk2077-input-loader/releases/download/v0.2.3/input_loader_v0.2.3.zip";
     29         hash = "sha256-DQxXWxam7OsUqjxPUCBaepiyRqMkpjr+L5mJEJNeW2Y=";
     30         stripRoot = false;
     31       })
     32       (fetchzip {
     33         url = "https://github.com/jac3km4/redscript/releases/download/v0.5.31/redscript-v0.5.31-windows.zip";
     34         hash = "sha256-IJySRAtmY685XAe3amDLgcrQjiSe6OIKPi5hyOGnBw4=";
     35         stripRoot = false;
     36       })
     37       (fetchzip {
     38         url = "https://github.com/jackhumbert/mod_settings/releases/download/v0.2.21/mod_settings_v0.2.21.zip";
     39         hash = "sha256-8uhdgPEJtcwt3ow0/9CXqvv5ikqbzvs37CRsAbVFpj0=";
     40         stripRoot = false;
     41       })
     42       (fetchzip {
     43         url = "https://github.com/wopss/RED4ext/releases/download/v1.29.1/red4ext_1.29.1.zip";
     44         hash = "sha256-O2x0STCR8pe8hg3YkLm8b1/j3RZXppfBljX5xYhPcbY=";
     45         stripRoot = false;
     46       })
     47       (fetchzip {
     48         url = "https://github.com/maximegmd/CyberEngineTweaks/releases/download/v1.37.1/cet_1.37.1.zip";
     49         hash = "sha256-thf/UU3sLlYO/yBYgRk97j6LGosICHoV/Jgqs9KnqgQ=";
     50         stripRoot = false;
     51       })
     52       (fetchzip {
     53         url = "https://github.com/jackhumbert/in_world_navigation/releases/download/v0.1.20/in_world_navigation_v0.1.20.zip";
     54         hash = "sha256-LD3MAENqkP6GHk3eYjGnEkzFlqPePE80X76QN4fspR8=";
     55         stripRoot = false;
     56       })
     57       (writeTextDir "/bin/x64/plugins/cyber_engine_tweaks/mods/utils/init.lua" (
     58         builtins.readFile ./cyberpunk-2077-utils.lua
     59       ))
     60     ];
     61   };
     62 
     63   settings = writeText "cyberpunk-2077-mod-settings.json" (
     64     builtins.toJSON {
     65       InWorldNavigation = {
     66         enabled = true;
     67         mode = "Driving";
     68         distanceToFade = 100.0;
     69         spacing = 10.0;
     70         maxPoints = 200;
     71       };
     72       FlightModeHoverFly = {
     73         enabled = true;
     74         heightDampening = 1.0;
     75         heightCorrectionFactor = 1.0;
     76       };
     77       FlightModeStandard = {
     78         standardModeYawFactor = 1.0;
     79         standardModeSurgeFactor = 15.0;
     80         standardModePitchInputAngle = 10.0;
     81         standardModeRollInputAngle = 30.0;
     82         standardModeSwayFactor = 45.0;
     83         standardModeHoverFactor = 10.0;
     84         standardModeRollFactor = 2.0;
     85         standardModeLiftFactor = 50.0;
     86         standardModePitchFactor = 0.5;
     87       };
     88       FlightSettings = {
     89         autoActivationEnabled = false;
     90         drivingDirectionCompensationAngleSmooth = 120.0;
     91         drivingDirectionCompensationSpeedCoef = 0.1;
     92         tppCameraCenterOnMass = true;
     93         fpvCameraPitchOffset = 0.0;
     94         tppCameraPitchOffset = 20.0;
     95         generalYawDirectionalityFactor = 5.0;
     96         generalPitchDirectionalityFactor = 15.0;
     97         generalYawAeroFactor = 0.0;
     98         generalDampFactorAngularMax = 3.5;
     99         generalDampFactorLinear = 0.0;
    100         generalPitchAeroFactor = 0.0;
    101         generalApplyFlightPhysicsWhenDeactivated = false;
    102         generalDampFactorAngular = 2.0;
    103         brakeFactorAngular = 1.0;
    104         brakeFactorLinear = 1.0;
    105       };
    106       FlightAudio = {
    107         windVolume = 1.0;
    108         engineVolume = 0.5;
    109         warningVolume = 0.5;
    110       };
    111       FlightComponent = {
    112         isQuickHackable = true;
    113         explosionThreshold = 0.5;
    114       };
    115       FlightController = {
    116         vehicleFlight = "IK_B";
    117 
    118         vehicleFlightYawRight = "IK_D";
    119         vehicleFlightRollRight = "IK_D";
    120         vehicleFlightSwayRight = "IK_D";
    121 
    122         vehicleFlightYawLeft = "IK_A";
    123         vehicleFlightRollLeft = "IK_A";
    124         vehicleFlightSwayLeft = "IK_A";
    125 
    126         vehicleFlightPitchForward = "IK_W";
    127         vehicleFlightPitchBackward = "IK_S";
    128 
    129         vehicleFlightLinearBrake = "IK_Space";
    130         vehicleFlightAngularBrake = "IK_Space";
    131 
    132         vehicleFlightLiftUp = "IK_LShift";
    133         vehicleFlightLiftDown = "IK_LControl";
    134 
    135         vehicleFlightModeSwitchForward = "IK_None";
    136         vehicleFlightModeSwitchBackward = "IK_None";
    137         vehicleFlightOptions = "IK_None";
    138         vehicleFlightUIToggle = "IK_None";
    139       };
    140       FlightModeAutomatic.enabled = false;
    141       FlightModeDroneAntiGravity.agEnabled = false;
    142       FlightModeFly.enabled = false;
    143       FlightModeDrone.enabled = false;
    144       FlightModeHover.enabled = false;
    145       IFlightConfiguration.areThrustersDetachable = true;
    146       hudFlightController.enabled = true;
    147     }
    148   );
    149 
    150   cetConfig = writeText "cyberpunk-2077-cet-config.json" (
    151     builtins.toJSON {
    152       patches.disable_boundary_teleport = true;
    153     }
    154   );
    155 
    156   cetBindings = writeText "cyberpunk-2077-cet-config.json" (
    157     builtins.toJSON {
    158       cet.overlay_key = 2251838468390912; # Backspace+Tab
    159     }
    160   );
    161 
    162   help = writeText "cyberpunk-2077-mod-info" ''
    163     Remember to add to launch options:
    164 
    165     WINEDLLOVERRIDES="winmm,version=n,b" %command% -modded --launcher-skip -skipStartScreen
    166   '';
    167 in
    168 writeShellApplication {
    169   name = "install-mods-cyberpunk-2077";
    170   text = ''
    171     out="''${1:-}"
    172     if [ -z "$out" ]; then
    173       out="$HOME/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Cyberpunk 2077"
    174       printf "Defaulting to: %s\n" "$out" >&2
    175     fi
    176     pushd "$out"
    177     cp -vrL --no-preserve=mode ${mods}/. .
    178 
    179     settings="$out/red4ext/plugins/mod_settings/user.ini"
    180     if [ ! -f "$settings" ]; then
    181       touch "$settings"
    182     fi
    183     yq -io=i '. *= load("${settings}")' "$settings"
    184 
    185     cetConfig="$out/bin/x64/plugins/cyber_engine_tweaks/config.json"
    186     if [ ! -f "$cetConfig" ]; then
    187       touch "$cetConfig"
    188     fi
    189     yq -io=j '. *= load("${cetConfig}")' "$cetConfig"
    190 
    191     cetBindings="$out/bin/x64/plugins/cyber_engine_tweaks/bindings.json"
    192     if [ ! -f "$cetBindings" ]; then
    193       touch "$cetBindings"
    194     fi
    195     yq -io=j '. *= load("${cetBindings}")' "$cetBindings"
    196 
    197     flatpak run com.github.Matoking.protontricks 1091500 -q d3dcompiler_47 vcrun2022
    198 
    199     cat ${help}
    200   '';
    201 }