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).
This commit is contained in:
2026-05-02 23:21:32 -04:00
parent 6b72ce2d6d
commit c9ddc8f8f2

View File

@@ -21,6 +21,12 @@
# location = "install" (default, steamapps/common/<dir>) | "prefix"
# (steamapps/compatdata/<appid>/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: