Both hosts/alphanaut/configuration.nix and hosts/misamino/configuration.nix contain ~40 lines of identical gaming-related configuration (gamemode, steam, sunshine, udev/uinput rules, 32-bit graphics). Extracting this into a shared module eliminates duplication and makes the gaming stack reusable.
Minimal host is unaffected — it has no gaming configuration.
- New:
modules/gaming.nix - Edit:
hosts/alphanaut/configuration.nix - Edit:
hosts/misamino/configuration.nix
{ pkgs, ... }:
{
# Feral GameMode
programs.gamemode.enable = true;
# Steam - post-setup: login, configure library folder
# MangoHud: use `mangohud %command%` in Steam game launch options
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
package = pkgs.steam.override {
extraPkgs = pkgs': with pkgs'; [ mangohud ];
};
};
# Sunshine - screen streaming
# https://127.0.0.1:47990 (ignore https warning)
# Default: admin / password
services.sunshine = {
enable = true;
autoStart = true;
capSysAdmin = true; # Required for Wayland/KMS (screen capture)
openFirewall = true;
};
# For Sunshine: https://myme.no/posts/2025-12-11-hifi-sunshine-on-nixos.html
# Host requirement: add "input" and "uinput" to users.users.rsc.extraGroups.
services.udev.extraRules = ''
KERNEL=="uinput", MODE="0660", GROUP="uinput", SYMLINK+="uinput"
'';
hardware.uinput.enable = true;
# Enable OpenGL 32-bit support (Steam, Wine, Proton)
# Host note: misamino adds extraPackages = [ intel-media-driver ] in its host config.
hardware.graphics = {
enable = true;
enable32Bit = true;
};
}Note: Fixes typo ignor → ignore in the Sunshine comment.
- Add
../../modules/gaming.nixto theimportslist, at the top (below existing imports). - Remove the following blocks:
programs.gamemode.enable = true;programs.steam = { ... };services.sunshine = { ... };services.udev.extraRulesblockhardware.uinput.enable = true;hardware.graphics = { enable = true; enable32Bit = true; };
Host-specific note: users.users.rsc.extraGroups still needs "input" and "uinput" — documented in gaming.nix comments.
-
Add
../../modules/gaming.nixto theimportslist, at the top (below existing imports). -
Remove the same blocks as alphanaut.
-
Replace the
hardware.graphicsblock with only the host-specificextraPackages:hardware.graphics.extraPackages = with pkgs; [ intel-media-driver ];
NixOS module system merges attrsets, so
enable/enable32Bitfromgaming.nixandextraPackagesfrom the host config compose correctly. -
Remove port
47990fromnetworking.firewall.allowedTCPPorts— it is redundant sinceservices.sunshine.openFirewall = truehandles it.
Host-specific note: users.users.rsc.extraGroups still needs "input" and "uinput" — documented in gaming.nix comments.
- Run
nix flake checkto catch syntax errors. - Run
nixos-rebuild dry-build --flake .#misaminoto verify misamino evaluates. - Run
nixos-rebuild dry-build --flake .#alphanautto verify alphanaut evaluates.
- Rollback: If evaluation breaks, both hosts are affected. Test one host's dry-build before committing both.
- Group dependency: The
"input"and"uinput"entries inusers.users.rsc.extraGroupsare required by Sunshine/uinput. Documented ingaming.nixcomments; remains in host configs. - Future: If a non-gaming graphical host is added later,
hardware.graphicsbase could move to a general workstation module.
READY