mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29: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,
|
lib,
|
||||||
std,
|
std,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
options.mewtris = let
|
|
||||||
inherit (lib.types) path attrsOf submodule str nullOr enum either package bool lines listOf;
|
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
|
||||||
inherit (lib.meta) getExe';
|
inherit (lib.meta) getExe';
|
||||||
|
in {
|
||||||
|
options.mewtris = let
|
||||||
|
inherit (lib.types) path attrsOf submodule str nullOr enum either package lines listOf;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
in {
|
in {
|
||||||
enable = mkEnableOption "Enable mewtris";
|
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 {
|
umuLauncher = mkOption {
|
||||||
description = "umu-launcher package";
|
description = "umu-launcher package";
|
||||||
type = package;
|
type = package;
|
||||||
|
|
@ -83,11 +85,6 @@
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
battleNetGame = mkOption {
|
|
||||||
description = "Is this a battle.net game? Not used for battle.net itself!";
|
|
||||||
type = bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
prefixArch = mkOption {
|
prefixArch = mkOption {
|
||||||
description = "Wine prefix architecture";
|
description = "Wine prefix architecture";
|
||||||
type = enum [
|
type = enum [
|
||||||
|
|
@ -179,9 +176,6 @@
|
||||||
])}"
|
])}"
|
||||||
${cfg.globalPrerun}
|
${cfg.globalPrerun}
|
||||||
${config.prerun}
|
${config.prerun}
|
||||||
${optionalString config.battleNetGame ''
|
|
||||||
"${protonLauncher}" "${config.gameFolder}/Battle.net Launcher.exe" &
|
|
||||||
''}
|
|
||||||
cd "${config.gameFolder}"
|
cd "${config.gameFolder}"
|
||||||
"${protonLauncher}" "${config.gameExecutable}" ${escapeShellArgs config.gameArguments}
|
"${protonLauncher}" "${config.gameExecutable}" ${escapeShellArgs config.gameArguments}
|
||||||
'';
|
'';
|
||||||
|
|
@ -196,13 +190,35 @@
|
||||||
};
|
};
|
||||||
config = let
|
config = let
|
||||||
cfg = config.mewtris;
|
cfg = config.mewtris;
|
||||||
inherit (lib.lists) singleton concatMap;
|
inherit (lib.lists) singleton concatMap concatLists;
|
||||||
inherit (lib.strings) replaceStrings;
|
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 (lib.modules) mkIf;
|
||||||
inherit (std.set) merge;
|
inherit (std.set) merge;
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
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:
|
systemd.user.services = mapAttrs' (_k: v:
|
||||||
nameValuePair v.name {
|
nameValuePair v.name {
|
||||||
description = v.long_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;
|
cfg = config.mewtris;
|
||||||
in {
|
in {
|
||||||
mewtris = let
|
mewtris = let
|
||||||
|
inherit (lib.strings) concatStringsSep;
|
||||||
gameStorage = "/home/kat/Games";
|
gameStorage = "/home/kat/Games";
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
createDesktopItems = true;
|
||||||
inherit gameStorage;
|
inherit gameStorage;
|
||||||
runnerVariants = {
|
runnerVariants = {
|
||||||
PROTON_CACHYOS = "${inputs.chaotic.packages.${pkgs.system}.proton-cachyos_x86_64_v3.out}/bin";
|
PROTON_CACHYOS = "${inputs.chaotic.packages.${pkgs.system}.proton-cachyos_x86_64_v3.out}/bin";
|
||||||
|
|
@ -21,7 +23,15 @@ in {
|
||||||
runnerEnvironments = {
|
runnerEnvironments = {
|
||||||
common = {
|
common = {
|
||||||
PROTON_LOG = builtins.toString 1;
|
PROTON_LOG = builtins.toString 1;
|
||||||
WINEDEBUG = "+warn";
|
WINEDEBUG = concatStringsSep "," [
|
||||||
|
"+warn"
|
||||||
|
"+timestamp"
|
||||||
|
"+pid"
|
||||||
|
"+tid"
|
||||||
|
"+seh"
|
||||||
|
"+debugstr"
|
||||||
|
"+module"
|
||||||
|
];
|
||||||
WINEUSERSANDBOX = builtins.toString 1;
|
WINEUSERSANDBOX = builtins.toString 1;
|
||||||
};
|
};
|
||||||
dxvk = {
|
dxvk = {
|
||||||
|
|
@ -38,9 +48,7 @@ in {
|
||||||
__GL_SHADER_DISK_CACHE = builtins.toString 1;
|
__GL_SHADER_DISK_CACHE = builtins.toString 1;
|
||||||
__GL_SHADER_DISK_CACHE_PATH = builtins.placeholder "prefix";
|
__GL_SHADER_DISK_CACHE_PATH = builtins.placeholder "prefix";
|
||||||
};
|
};
|
||||||
mangohud = let
|
mangohud = {
|
||||||
inherit (lib.strings) concatStringsSep;
|
|
||||||
in {
|
|
||||||
MANGOHUD = builtins.toString 1;
|
MANGOHUD = builtins.toString 1;
|
||||||
MANGOHUD_CONFIG = concatStringsSep "," [
|
MANGOHUD_CONFIG = concatStringsSep "," [
|
||||||
"no_display"
|
"no_display"
|
||||||
|
|
@ -91,18 +99,24 @@ in {
|
||||||
battlenet = {
|
battlenet = {
|
||||||
long_name,
|
long_name,
|
||||||
launchArg,
|
launchArg,
|
||||||
}: (protonCommon
|
}: let
|
||||||
// rec {
|
|
||||||
inherit long_name;
|
|
||||||
battleNetGame = false;
|
|
||||||
prefixFolder = gameStorage + "/battlenet";
|
prefixFolder = gameStorage + "/battlenet";
|
||||||
gameFolder = prefixFolder + "/drive_c/Program Files (x86)/Battle.net";
|
gameFolder' = "C:\\Program Files (x86)\\Battle.net";
|
||||||
gameExecutable = gameFolder + "/Battle.net.exe";
|
gameExecutable' = "Battle.net.exe";
|
||||||
|
in
|
||||||
|
protonCommon
|
||||||
|
// {
|
||||||
|
inherit long_name prefixFolder;
|
||||||
|
gameFolder = prefixFolder;
|
||||||
|
gameExecutable = "./drive_c/cmd.exe";
|
||||||
gameArguments = [
|
gameArguments = [
|
||||||
"--in-process-gpu"
|
"/k"
|
||||||
"--exec=\"launch ${launchArg}\""
|
"C:/script.bat"
|
||||||
|
gameFolder'
|
||||||
|
gameExecutable'
|
||||||
|
launchArg
|
||||||
];
|
];
|
||||||
});
|
};
|
||||||
vn = {
|
vn = {
|
||||||
long_name,
|
long_name,
|
||||||
vnDir,
|
vnDir,
|
||||||
|
|
@ -257,6 +271,8 @@ in {
|
||||||
# games;
|
# games;
|
||||||
|
|
||||||
home-manager.users.kat.home.file = {
|
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/
|
# https://learnjapanese.moe/vn-linux/
|
||||||
"Games/VNs/drive_c/script.bat".source = ./vn_script.bat;
|
"Games/VNs/drive_c/script.bat".source = ./vn_script.bat;
|
||||||
"Games/VNs/drive_c/cmd.exe".source = ./reactos_cmd.exe;
|
"Games/VNs/drive_c/cmd.exe".source = ./reactos_cmd.exe;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue