From c9ddc8f8f2b6c990951a43d7a4c695fafa956b7c Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Sat, 2 May 2026 23:21:32 -0400 Subject: [PATCH] game-mods: restore BACKUP_SUFFIX, doc launchOptions, fix blank lines Three small follow-ups to 1751603: - BACKUP_SUFFIX was lost during the launchOptions refactor. apply_mod references it on every non-skip path (new target, drifted bytes, or replace mode), so the moment a deployment hit one of those, the service would NameError at runtime. The bug was latent on yarn because every dropped file's bytes already matched its source, so every apply short-circuited at the byte-match check; an empirical rm libxell.dll + systemctl start reproduced the NameError before the fix and showed a successful recreate after. - Mention launchOptions in the leading file docstring. The Example block already covers file ops; the new option had no entry-level doc. - Normalize blank lines between top-level Python defs in the heredoc (PEP-8 wants exactly two: we had four between apply_mod and apply_launch_options, zero between apply_launch_options and main). --- modules/desktop-game-mods.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/desktop-game-mods.nix b/modules/desktop-game-mods.nix index 9ce8ee7..75560da 100644 --- a/modules/desktop-game-mods.nix +++ b/modules/desktop-game-mods.nix @@ -21,6 +21,12 @@ # location = "install" (default, steamapps/common/) | "prefix" # (steamapps/compatdata//pfx — for user-storage mods) # +# Each mod can also declare `launchOptions = [ "FOO=bar" ]`. Lists from +# every mod targeting the same Steam App ID are concatenated (mod-name +# alphabetical), joined with spaces, and `%command%` is appended once. +# The result is written into Steam's per-app block in localconfig.vdf +# so it persists across Steam restarts. +# # Example: stub the cold-start intro video, plus drop a sound mod XML into # the Wine prefix's user storage. # services.gameMods.mods."fh5" = { @@ -195,6 +201,7 @@ let MOD_DATA = json.loads(${lib.escapeShellArg modData}) LAUNCH_OPTIONS_DATA = json.loads(${lib.escapeShellArg launchOptionsData}) + BACKUP_SUFFIX = ".nix-backup" def find_steam_root(): @@ -327,8 +334,6 @@ let print(f"game-mods: {verb} {target}", file=sys.stderr) - - def apply_launch_options(): """Write declarative launch options into Steam's localconfig.vdf. @@ -403,6 +408,8 @@ let ) print("game-mods: launch options done", file=sys.stderr) + + def main(): if MOD_DATA: for entry in MOD_DATA: