{ config, lib, pkgs, ... }: let cfg = config.nomarchy.system.gaming; in { config = lib.mkIf cfg.enable { programs.steam = { enable = true; remotePlay.openFirewall = lib.mkDefault true; localNetworkGameTransfers.openFirewall = lib.mkDefault true; }; # gamemode adjusts CPU governor and reschedules processes when a # game requests it. The launching user must be in the `gamemode` group. programs.gamemode.enable = true; services.flatpak.enable = true; # `services.flatpak.enable = true` ships flatpak but does NOT add any # remotes — without a remote, `flatpak install` and the Discover GUI # can't find anything. nixpkgs has no declarative remote-add API yet, # so we run a one-shot system unit after flatpak.service is ready that # adds the flathub remote idempotently (`--if-not-exists`). Lives under # the gaming preset because Pillar 5 ships flatpak as part of the # gaming wiring; if another preset later needs flatpak, lift this to a # dedicated module. systemd.services.nomarchy-flathub-init = { description = "Register the Flathub remote on first start"; wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; wants = [ "network-online.target" ]; path = [ pkgs.flatpak ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; }; script = '' flatpak remote-add --if-not-exists flathub \ https://dl.flathub.org/repo/flathub.flatpakrepo ''; }; }; }