From c7d7cb845b22e8743f85ce0d9536846fdc01b805 Mon Sep 17 00:00:00 2001 From: worble Date: Tue, 14 Oct 2025 14:31:38 +0100 Subject: [PATCH] wrap wine and umu to avoid flooding session with variables --- home-manager/gaming.nix | 87 +++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/home-manager/gaming.nix b/home-manager/gaming.nix index 328c0e2..33c1502 100644 --- a/home-manager/gaming.nix +++ b/home-manager/gaming.nix @@ -2,26 +2,51 @@ let pkgs_unstable = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}"; + + # https://simpler-website.pages.dev/html/2021/1/wine-environment-variables/#wineesync + wine-wrapped = (pkgs.writeShellApplication { + name = "wine"; + runtimeInputs = [ pkgs_unstable.wineWowPackages.stagingFull ]; + text = '' + export WINEPREFIX="''${WINEPREFIX:-"$HOME/Games/wine/default"}" + wine "$@" + ''; + }); + + # https://github.com/GloriousEggroll/proton-ge-custom?tab=readme-ov-file#modification + # These aren't yet documented in the README: + # PROTON_MEDIA_USE_GST=1 will tell proton to use the winegstreamer backend instead of the default winedmo backend (the winedmo backend was introduced in Proton 10 and is the current preferred video playback method). This can be useful for games with videos that may have worked in Proton 9 but regressed in Proton 10. + # PROTON_GST_VIDEO_ORIENTATION= can be any of the following: vertical-flip, horizontal-flip, rotate-180, automatic. This is useful if some games have videos that are upside down or otherwise not oriented correctly. + umu-wrapped = (pkgs.writeShellApplication { + name = "umu-run"; + runtimeInputs = [ pkgs_unstable.umu-launcher ]; + text = '' + export PROTONPATH="''${PROTONPATH:-"GE-Proton"}" + export PROTON_ENABLE_WAYLAND="''${PROTON_ENABLE_WAYLAND:-"0"}" + umu-run "$@" + ''; + }); in { home.packages = with pkgs;[ - # Wine / Proton - pkgs_unstable.wineWowPackages.stagingFull + # Wine / Proton + umu-wrapped + wine-wrapped pkgs_unstable.winetricks - pkgs_unstable.umu-launcher - # I'm not sure this actually accomplishes anything, even with PROTON_MEDIA_USE_GST=1 - # (umu-launcher.override { - # extraPkgs = pkgs: with pkgs.gst_all_1; [ - # gstreamer - # gst-plugins-base - # gst-plugins-good - # gst-plugins-bad - # gst-plugins-ugly - # gst-libav - # gst-vaapi - # ]; - # }) + # proton with ja_JP + (pkgs.writeShellApplication { + name = "umu-ja"; + runtimeInputs = [ umu-wrapped ]; + text = "LANG=ja_JP.utf8 umu-run \"$@\""; + }) + + # wine with ja_JP + (pkgs.writeShellApplication { + name = "wine-ja"; + runtimeInputs = [ wine-wrapped ]; + text = "LANG=ja_JP.utf8 wine \"$@\""; + }) bottles (heroic.override { @@ -39,37 +64,5 @@ in # Cheat engine scanmem - - # proton with ja_JP - (pkgs.writeShellApplication { - name = "umu-ja"; - runtimeInputs = [ pkgs_unstable.umu-launcher ]; - text = "LANG=ja_JP.utf8 umu-run \"$@\""; - }) - - # wine with ja_JP - (pkgs.writeShellApplication { - name = "wine-ja"; - runtimeInputs = [ pkgs_unstable.wineWowPackages.stagingFull ]; - text = "LANG=ja_JP.utf8 wine \"$@\""; - }) ]; - - # https://github.com/GloriousEggroll/proton-ge-custom?tab=readme-ov-file#modification - # There aren't yet documented in the README: - # PROTON_MEDIA_USE_GST=1 will tell proton to use the winegstreamer backend instead of the default winedmo backend (the winedmo backend was introduced in Proton 10 and is the current preferred video playback method). This can be useful for games with videos that may have worked in Proton 9 but regressed in Proton 10. - # PROTON_GST_VIDEO_ORIENTATION= can be any of the following: vertical-flip, horizontal-flip, rotate-180, automatic. This is useful if some games have videos that are upside down or otherwise not oriented correctly. - # https://simpler-website.pages.dev/html/2021/1/wine-environment-variables/#wineesync - home.sessionVariables = { - WINEPREFIX = "~/Games/wine/default"; - PROTONPATH = "GE-Proton"; - PROTON_ENABLE_WAYLAND = "0"; # One day... - }; - - # programs.lutris = { - # enable = true; - # extraPackages = with pkgs; [ mangohud winetricks gamescope gamemode umu-launcher ]; - # protonPackages = [ pkgs.proton-ge-bin ]; - # winePackages = [ pkgs.wineWowPackages.staging ]; - # }; }