From 6f35d60aab0f1198714670053c88be2cc9a66ab7 Mon Sep 17 00:00:00 2001 From: OlivierChiasson Date: Fri, 17 Jul 2026 17:37:38 -0300 Subject: [PATCH] refactor(system): simplify steamTinkerLaunch logic and package assignment Refactor the steamExtraPkgs conditional logic into a single line and introduce a launcherSet variable to reduce redundancy when assigning packages to the system or specific users. --- modules/system/gaming.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/system/gaming.nix b/modules/system/gaming.nix index 0af3928..e45416b 100644 --- a/modules/system/gaming.nix +++ b/modules/system/gaming.nix @@ -17,10 +17,9 @@ ++ lib.optionals pkgs.stdenv.isx86_64 [ heroic ]; steamExtraPkgs = - if !cfg.steam.steamTinkerLaunch.enable then - [ ] - else - lib.optional (lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.steamtinkerlaunch) pkgs.steamtinkerlaunch; + lib.optional (cfg.steam.steamTinkerLaunch.enable && lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.steamtinkerlaunch) pkgs.steamtinkerlaunch; + + launcherSet = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages; in { options.chiasson.system.gaming = { @@ -194,11 +193,11 @@ ]; } (lib.mkIf (cfg.launchers.forUsers == null) { - environment.systemPackages = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages; + environment.systemPackages = launcherSet; }) (lib.mkIf (cfg.launchers.forUsers != null) { users.users = lib.genAttrs cfg.launchers.forUsers (_: { - packages = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages; + packages = launcherSet; }); }) ]);