mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat(mewtris): battle.net handled sanely-ish (60s timeout???)
This commit is contained in:
parent
68dcd8768c
commit
142861f957
3 changed files with 76 additions and 27 deletions
|
|
@ -4,13 +4,15 @@
|
|||
lib,
|
||||
std,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
inherit (lib.meta) getExe';
|
||||
in {
|
||||
options.mewtris = let
|
||||
inherit (lib.types) path attrsOf submodule str nullOr enum either package bool lines listOf;
|
||||
inherit (lib.types) path attrsOf submodule str nullOr enum either package lines listOf;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe';
|
||||
in {
|
||||
enable = mkEnableOption "Enable mewtris";
|
||||
createDesktopItems = mkEnableOption "Create XDG desktop items for starting, stopping and killing all the installed mewtris games, for use with dmenu or wofi for example";
|
||||
umuLauncher = mkOption {
|
||||
description = "umu-launcher package";
|
||||
type = package;
|
||||
|
|
@ -83,11 +85,6 @@
|
|||
type = listOf str;
|
||||
default = [];
|
||||
};
|
||||
battleNetGame = mkOption {
|
||||
description = "Is this a battle.net game? Not used for battle.net itself!";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
prefixArch = mkOption {
|
||||
description = "Wine prefix architecture";
|
||||
type = enum [
|
||||
|
|
@ -179,9 +176,6 @@
|
|||
])}"
|
||||
${cfg.globalPrerun}
|
||||
${config.prerun}
|
||||
${optionalString config.battleNetGame ''
|
||||
"${protonLauncher}" "${config.gameFolder}/Battle.net Launcher.exe" &
|
||||
''}
|
||||
cd "${config.gameFolder}"
|
||||
"${protonLauncher}" "${config.gameExecutable}" ${escapeShellArgs config.gameArguments}
|
||||
'';
|
||||
|
|
@ -196,13 +190,35 @@
|
|||
};
|
||||
config = let
|
||||
cfg = config.mewtris;
|
||||
inherit (lib.lists) singleton concatMap;
|
||||
inherit (lib.lists) singleton concatMap concatLists;
|
||||
inherit (lib.strings) replaceStrings;
|
||||
inherit (lib.attrsets) mapAttrs nameValuePair mapAttrs' attrNames attrValues;
|
||||
inherit (lib.attrsets) mapAttrs nameValuePair mapAttrs' attrNames attrValues mapAttrsToList;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (std.set) merge;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
environment.systemPackages = mkIf cfg.createDesktopItems (concatLists (mapAttrsToList (_k: v: let
|
||||
start = pkgs.makeDesktopItem {
|
||||
inherit (v) name;
|
||||
desktopName = v.long_name;
|
||||
exec = "${getExe' pkgs.systemd "systemctl"} --user start ${v.name}";
|
||||
};
|
||||
stop = pkgs.makeDesktopItem {
|
||||
name = "${v.name}-stop";
|
||||
desktopName = "Stop ${v.long_name}";
|
||||
exec = "${getExe' pkgs.systemd "systemctl"} --user stop ${v.name}";
|
||||
};
|
||||
kill = pkgs.makeDesktopItem {
|
||||
name = "${v.name}-kill";
|
||||
desktopName = "Kill ${v.long_name}";
|
||||
exec = "${getExe' pkgs.systemd "systemctl"} --user kill --signal=SIGKILL ${v.name}";
|
||||
};
|
||||
in [
|
||||
start
|
||||
stop
|
||||
kill
|
||||
])
|
||||
config.mewtris.games));
|
||||
systemd.user.services = mapAttrs' (_k: v:
|
||||
nameValuePair v.name {
|
||||
description = v.long_name;
|
||||
|
|
|
|||
17
nixos/profiles/gaming/bnet_script.bat
Executable file
17
nixos/profiles/gaming/bnet_script.bat
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
@echo on
|
||||
set BNET_DIR=%1
|
||||
set BNET_EXE=%~2
|
||||
set GAME=%3
|
||||
|
||||
echo "Setting UTF-8..."
|
||||
chcp 65001 > nul
|
||||
|
||||
echo "Launching Battle.net..."
|
||||
cd /d %BNET_DIR%
|
||||
start /b %BNET_EXE% --in-process-gpu
|
||||
|
||||
timeout /t 60 /nobreak > NUL
|
||||
|
||||
echo "Launching game within Battle.net..."
|
||||
start /b %BNET_EXE% --exec="launch %GAME%"
|
||||
REM exit
|
||||
|
|
@ -9,9 +9,11 @@
|
|||
cfg = config.mewtris;
|
||||
in {
|
||||
mewtris = let
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
gameStorage = "/home/kat/Games";
|
||||
in {
|
||||
enable = true;
|
||||
createDesktopItems = true;
|
||||
inherit gameStorage;
|
||||
runnerVariants = {
|
||||
PROTON_CACHYOS = "${inputs.chaotic.packages.${pkgs.system}.proton-cachyos_x86_64_v3.out}/bin";
|
||||
|
|
@ -21,7 +23,15 @@ in {
|
|||
runnerEnvironments = {
|
||||
common = {
|
||||
PROTON_LOG = builtins.toString 1;
|
||||
WINEDEBUG = "+warn";
|
||||
WINEDEBUG = concatStringsSep "," [
|
||||
"+warn"
|
||||
"+timestamp"
|
||||
"+pid"
|
||||
"+tid"
|
||||
"+seh"
|
||||
"+debugstr"
|
||||
"+module"
|
||||
];
|
||||
WINEUSERSANDBOX = builtins.toString 1;
|
||||
};
|
||||
dxvk = {
|
||||
|
|
@ -38,9 +48,7 @@ in {
|
|||
__GL_SHADER_DISK_CACHE = builtins.toString 1;
|
||||
__GL_SHADER_DISK_CACHE_PATH = builtins.placeholder "prefix";
|
||||
};
|
||||
mangohud = let
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
in {
|
||||
mangohud = {
|
||||
MANGOHUD = builtins.toString 1;
|
||||
MANGOHUD_CONFIG = concatStringsSep "," [
|
||||
"no_display"
|
||||
|
|
@ -91,18 +99,24 @@ in {
|
|||
battlenet = {
|
||||
long_name,
|
||||
launchArg,
|
||||
}: (protonCommon
|
||||
// rec {
|
||||
inherit long_name;
|
||||
battleNetGame = false;
|
||||
prefixFolder = gameStorage + "/battlenet";
|
||||
gameFolder = prefixFolder + "/drive_c/Program Files (x86)/Battle.net";
|
||||
gameExecutable = gameFolder + "/Battle.net.exe";
|
||||
}: let
|
||||
prefixFolder = gameStorage + "/battlenet";
|
||||
gameFolder' = "C:\\Program Files (x86)\\Battle.net";
|
||||
gameExecutable' = "Battle.net.exe";
|
||||
in
|
||||
protonCommon
|
||||
// {
|
||||
inherit long_name prefixFolder;
|
||||
gameFolder = prefixFolder;
|
||||
gameExecutable = "./drive_c/cmd.exe";
|
||||
gameArguments = [
|
||||
"--in-process-gpu"
|
||||
"--exec=\"launch ${launchArg}\""
|
||||
"/k"
|
||||
"C:/script.bat"
|
||||
gameFolder'
|
||||
gameExecutable'
|
||||
launchArg
|
||||
];
|
||||
});
|
||||
};
|
||||
vn = {
|
||||
long_name,
|
||||
vnDir,
|
||||
|
|
@ -257,6 +271,8 @@ in {
|
|||
# games;
|
||||
|
||||
home-manager.users.kat.home.file = {
|
||||
"Games/battlenet/drive_c/script.bat".source = ./bnet_script.bat;
|
||||
"Games/battlenet/drive_c/cmd.exe".source = ./reactos_cmd.exe;
|
||||
# https://learnjapanese.moe/vn-linux/
|
||||
"Games/VNs/drive_c/script.bat".source = ./vn_script.bat;
|
||||
"Games/VNs/drive_c/cmd.exe".source = ./reactos_cmd.exe;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue