From efef69a51dd48a12beb518b67c534238842249d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E9=9B=81=20Cryolitia?= Date: Sun, 26 May 2024 22:03:50 +0800 Subject: [PATCH 1/2] nixos/steam: add option `extraPackages` --- nixos/modules/programs/steam.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix index 31577ac2de45..245afc8d399b 100644 --- a/nixos/modules/programs/steam.nix +++ b/nixos/modules/programs/steam.nix @@ -55,6 +55,7 @@ in { then [ package ] ++ extraPackages else [ package32 ] ++ extraPackages32; in prevLibs ++ additionalLibs; + extraPkgs = p: (cfg.extraPackages ++ lib.optionals (prev ? extraPkgs) (prev.extraPkgs p)); } // lib.optionalAttrs (cfg.gamescopeSession.enable && gamescopeCfg.capSysNice) { buildFHSEnv = pkgs.buildFHSEnv.override { @@ -71,6 +72,19 @@ in { ''; }; + extraPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + example = lib.literalExpression '' + with pkgs; [ + gamescope + ] + ''; + description = '' + Additional packages to add to the Steam environment. + ''; + }; + extraCompatPackages = lib.mkOption { type = lib.types.listOf lib.types.package; default = [ ]; From 164f66169a0bae512fc445d4f888f78012f05781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E9=9B=81=20Cryolitia?= Date: Sun, 26 May 2024 22:55:38 +0800 Subject: [PATCH 2/2] nixos/steam: add option fontPackages fix #178121 --- nixos/modules/programs/steam.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix index 245afc8d399b..6af8d3aea903 100644 --- a/nixos/modules/programs/steam.nix +++ b/nixos/modules/programs/steam.nix @@ -102,6 +102,18 @@ in { ''; }; + fontPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = config.fonts.packages; + defaultText = lib.literalExpression "fonts.packages"; + example = lib.literalExpression "with pkgs; [ source-han-sans ]"; + description = '' + Font packages to use in Steam. + + Defaults to system fonts, but could be overridden to use other fonts — useful for users who would like to customize CJK fonts used in Steam. According to the [upstream issue](https://github.com/ValveSoftware/steam-for-linux/issues/10422#issuecomment-1944396010), Steam only follows the per-user fontconfig configuration. + ''; + }; + remotePlay.openFirewall = lib.mkOption { type = lib.types.bool; default = false; @@ -179,6 +191,8 @@ in { }; }; + programs.steam.extraPackages = cfg.fontPackages; + programs.gamescope.enable = lib.mkDefault cfg.gamescopeSession.enable; services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ];