From 21ee9c6035ea6e8e93b906fdb81ef8848499ef2a Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sun, 26 Apr 2026 09:10:52 +0100 Subject: [PATCH] feat(system): add gaming preset module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Opt-in `nomarchy.system.gaming.enable` (default false). Wires `programs.steam` (with `remotePlay` and `localNetworkGameTransfers` firewall holes opened via `mkDefault`), `programs.gamemode` (the launching user must be in the `gamemode` group), and `services.flatpak`. Two pieces of the original roadmap entry split into separate Next-column rows so the system-side preset ships now: 1. Hyprland fullscreen-on-Steam-launch window rule (home-side). 2. Declarative flathub remote (nixpkgs has no API for this; needs either an overlay or a one-shot systemd unit). The flatpak service is enabled but the user must add flathub manually after first boot — documented in OPTIONS.md. --- core/system/default.nix | 1 + core/system/gaming.nix | 20 ++++++++++++++++++++ core/system/options.nix | 12 ++++++++++++ docs/OPTIONS.md | 4 ++++ docs/ROADMAP.md | 4 +++- 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 core/system/gaming.nix diff --git a/core/system/default.nix b/core/system/default.nix index b9d7719..462e8ec 100644 --- a/core/system/default.nix +++ b/core/system/default.nix @@ -22,6 +22,7 @@ ./laptop.nix ./desktop.nix ./accessibility.nix + ./gaming.nix ./hibernate.nix ./containers.nix ./pam.nix diff --git a/core/system/gaming.nix b/core/system/gaming.nix new file mode 100644 index 0000000..32ae4dc --- /dev/null +++ b/core/system/gaming.nix @@ -0,0 +1,20 @@ +{ config, lib, ... }: + +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; + }; +} diff --git a/core/system/options.nix b/core/system/options.nix index 1dfab59..1596b5d 100644 --- a/core/system/options.nix +++ b/core/system/options.nix @@ -145,6 +145,18 @@ }; }; + gaming = { + enable = lib.mkEnableOption '' + Gaming preset: Steam (with remote-play firewall holes), + gamemode (CPU governor + nice on Steam launch via the user's + gamemode group), and flatpak. NOTE: flatpak's flathub remote + is not added declaratively — after first boot, run + `flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo`. + The Hyprland fullscreen-on-Steam-launch window rule is a + separate roadmap item. + ''; + }; + containers = { enable = lib.mkEnableOption '' Rootless Podman with Docker compatibility (`docker` → `podman`), diff --git a/docs/OPTIONS.md b/docs/OPTIONS.md index dd4632a..338a97f 100644 --- a/docs/OPTIONS.md +++ b/docs/OPTIONS.md @@ -87,6 +87,10 @@ Wired in `features/desktop/waybar/default.nix` (filters the battery widget out o `int`, default `32`. `XCURSOR_SIZE` when `accessibility.enable = true`. NixOS default is 24; 32 is a safer floor for low-vision users. +### `nomarchy.system.gaming.enable` + +`bool`, default `false`. Gaming preset: enables `programs.steam` (with `remotePlay` and `localNetworkGameTransfers` firewall holes opened by `mkDefault`), `programs.gamemode` (the launching user must be in the `gamemode` group), and `services.flatpak`. The flathub remote isn't added declaratively — after first boot, run `flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo`. The Hyprland fullscreen-on-Steam-launch window rule is a separate roadmap item. + ### `nomarchy.system.containers.enable` `bool`, default `false`. Rootless Podman with Docker compatibility (`docker` → `podman`), plus `podman-compose`, `podman-tui`, and `dive`. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 285f5c0..55c966c 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -24,7 +24,8 @@ Guardrails (apply when adding anything): ### Next (bigger lifts that build on Now) - **Accessibility — home-side companion.** Hyprland-side bits the system preset can't reach: slower `input.repeat_rate` / `repeat_delay` defaults, `SUPER+ALT+S` keybinding to launch Orca, and a high-contrast palette under `themes/palettes/`. Gated on a new `nomarchy.accessibility.enable` mirror of the system option. -- **Gaming preset.** `programs.steam.enable`, `programs.gamemode.enable`, `services.flatpak.enable` with a curated remote, and a Hyprland window-rule to fullscreen Steam-launched apps. +- **Gaming — Hyprland window rule.** Companion to the gaming preset: a Hyprland `windowrulev2 = fullscreen, class:^(steam_app_).*$` (or similar) so games launched from Steam grab the whole screen. Lives in `core/home/config/nomarchy/default/hypr/` and gates on a new `nomarchy.gaming.enable` mirror. +- **Gaming — declarative flathub remote.** `services.flatpak.enable` doesn't ship a declarative remote API in nixpkgs. Either add the `flatpak-managed-install` overlay, write a one-shot systemd unit that runs `flatpak remote-add --if-not-exists flathub …`, or surface the manual step in `nomarchy-welcome`. - **First-run welcome wizard.** Extend `nomarchy-welcome` from a one-shot greeter into a guided picker: theme, panel position, monospace font, "what's a sane home.nix to start with?". Runs once, persists "done" in `state.json`. - **Plymouth theme variants per palette.** Currently one Plymouth theme; could template per-palette so the boot splash matches the active theme. - **`docs/TROUBLESHOOTING.md`.** The five most common rebuild errors (`option ... already declared`, `attribute ... missing`, Stylix target conflicts, home-manager backupFileExtension churn, impermanence path missing) with copy-paste fixes. @@ -124,6 +125,7 @@ Each PR description should reference the row(s) in `docs/SCRIPTS.md` it closes, (Move items here when they land — keep them brief, link the commit/PR.) +- _2026-04-26_ — Gaming preset module (`core/system/gaming.nix`). Opt-in `nomarchy.system.gaming.enable` (default false). Wires `programs.steam` (with `remotePlay`/`localNetworkGameTransfers` firewall holes via `mkDefault`), `programs.gamemode`, and `services.flatpak`. Flathub remote and Hyprland window-rule split into separate Next-column rows. - _2026-04-26_ — Accessibility preset module (`core/system/accessibility.nix`). New `nomarchy.system.accessibility.{enable,cursorSize}` options (opt-in, default off — accessibility isn't a hardware-derived signal). Enables `services.gnome.at-spi2-core`, installs Orca, and sets `XCURSOR_SIZE=32` (configurable). Hyprland-side companion (key-repeat slowdown, Orca keybinding, high-contrast palette) split into a new Next-column row. - _2026-04-26_ — Desktop preset module (`core/system/desktop.nix`). New `nomarchy.system.desktop.enable` option; defaults to `formFactor == "desktop"` (mirror of the laptop preset's auto-enable). Pins `powerManagement.cpuFreqGovernor` to `"performance"` and enables `services.zfs.{autoScrub,trim}` so a future ZFS pool gets sensible maintenance for free. - _2026-04-26_ — Laptop preset module (`core/system/laptop.nix`). New `nomarchy.system.laptop.{enable,thermald}` options; `enable` defaults to `formFactor == "laptop"` so the installer's existing `formFactor` write auto-flips it on. Wires TLP (governors + 75/80 charge thresholds), force-disables `power-profiles-daemon`, enables `upower` and `thermald` (x86_64), adds the brightnessctl udev rule for backlight without root, and sets a logind lid-switch policy that defers to `hibernation.enable`. Closes both the Now item and the largest Next item.