gaming: move home module to gaming/ dir, add moonlight client toggle
CI / lint (push) Successful in 1m5s
CI / eval (push) Failing after 2m20s

Mirror the hosts/common/features/gaming/ layout on the home side: turn the
single gaming.nix into a gaming/ directory. Moonlight (the client
counterpart to the Sunshine host) becomes moonlight.nix, gated by its own
custom.gaming.moonlight option so a host can install just the streaming
client without the full launcher/Proton toolkit (custom.gaming.enable).

- gaming.nix -> gaming/default.nix (imports moonlight.nix)
- gaming/moonlight.nix: custom.gaming.moonlight -> moonlight-qt
- arrakis: import gaming module, set custom.gaming.moonlight = true
  (replaces the one-off home.packages line)
- konishi: update import path to the directory

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-07-06 09:49:04 +01:00
parent afd9646189
commit c4a5515297
4 changed files with 37 additions and 1 deletions
+78
View File
@@ -0,0 +1,78 @@
{
config,
lib,
pkgs,
...
}:
# User-space gaming toolkit. Vendor-agnostic on purpose so it can be reused on
# AMD/Intel hosts — the only GPU-vendor-aware branch is `cfg.nvidia`, kept
# deliberately small. The host still owns the privileged pieces (Steam FHS
# wrapper, Sunshine, gamemode, gamescope caps) under
# hosts/common/features/gaming.
#
# Per-host segregation is by option: a host imports this module and enables only
# the pieces it wants (e.g. a laptop enables `moonlight` for streaming without
# the full `enable` launcher/Proton toolkit).
let
cfg = config.custom.gaming;
in
{
imports = [ ./moonlight.nix ];
options.custom.gaming = {
enable = lib.mkEnableOption "user-space gaming tools (launchers, Proton mgmt, MangoHud)";
nvidia = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable NVIDIA-specific extras (currently just nvtop). Keep this the only
NVIDIA-aware branch in this file so the module stays reusable on other
GPUs. NVENC streaming needs no user config it comes from the host
NVIDIA driver.
'';
};
};
config = lib.mkIf cfg.enable {
# NOTE: Steam itself is enabled at the host level (programs.steam) because it
# needs the FHS wrapper, udev rules and 32-bit graphics — home-manager can't
# provide those. See hosts/common/features/gaming/steam.nix.
home.packages =
with pkgs;
[
# launchers / stores
lutris
heroic # Epic / GOG / Amazon
# Proton / Wine compatibility tooling
protonplus # install & manage Proton-GE builds
protontricks
winetricks
# overlays, tuning & diagnostics
goverlay # GUI to configure MangoHud / vkBasalt
vkbasalt # Vulkan post-processing layer
vulkan-tools # vulkaninfo / vkcube for sanity checks
]
++ lib.optionals cfg.nvidia [
nvtopPackages.nvidia # GPU/VRAM/encoder monitor
];
# In-game performance overlay (toggle with Shift+F12 by default).
programs.mangohud = {
enable = true;
settings = {
fps_limit = 0;
gpu_stats = true;
gpu_temp = true;
vram = true;
cpu_stats = true;
cpu_temp = true;
ram = true;
frametime = true;
frame_timing = true;
};
};
};
}
+26
View File
@@ -0,0 +1,26 @@
{
config,
lib,
pkgs,
...
}:
# Moonlight — client counterpart to the Sunshine host
# (hosts/common/features/gaming/sunshine.nix). User-space, so it lives here in
# the home gaming module rather than next to the Sunshine service.
#
# Gated by its own option, independent of `custom.gaming.enable`: a laptop can
# install just the streaming client without the full launcher/Proton toolkit.
#
# First run: launch `moonlight`, then pair to the Sunshine host by entering the
# PIN Moonlight shows into Sunshine's web UI (https://<host>:47990). Moonlight
# discovers hosts on the LAN via Sunshine's mDNS.
let
cfg = config.custom.gaming;
in
{
options.custom.gaming.moonlight = lib.mkEnableOption "Moonlight game-streaming client";
config = lib.mkIf cfg.moonlight {
home.packages = [ pkgs.moonlight-qt ];
};
}