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.
This commit is contained in:
@@ -17,10 +17,9 @@
|
|||||||
++ lib.optionals pkgs.stdenv.isx86_64 [ heroic ];
|
++ lib.optionals pkgs.stdenv.isx86_64 [ heroic ];
|
||||||
|
|
||||||
steamExtraPkgs =
|
steamExtraPkgs =
|
||||||
if !cfg.steam.steamTinkerLaunch.enable then
|
lib.optional (cfg.steam.steamTinkerLaunch.enable && lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.steamtinkerlaunch) pkgs.steamtinkerlaunch;
|
||||||
[ ]
|
|
||||||
else
|
launcherSet = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages;
|
||||||
lib.optional (lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.steamtinkerlaunch) pkgs.steamtinkerlaunch;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.chiasson.system.gaming = {
|
options.chiasson.system.gaming = {
|
||||||
@@ -194,11 +193,11 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
(lib.mkIf (cfg.launchers.forUsers == null) {
|
(lib.mkIf (cfg.launchers.forUsers == null) {
|
||||||
environment.systemPackages = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages;
|
environment.systemPackages = launcherSet;
|
||||||
})
|
})
|
||||||
(lib.mkIf (cfg.launchers.forUsers != null) {
|
(lib.mkIf (cfg.launchers.forUsers != null) {
|
||||||
users.users = lib.genAttrs cfg.launchers.forUsers (_: {
|
users.users = lib.genAttrs cfg.launchers.forUsers (_: {
|
||||||
packages = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages;
|
packages = launcherSet;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user