Add basic conf for sunshine game streaming on NixOS

This commit is contained in:
Vili Sinervä 2025-01-11 14:27:15 +02:00
parent 5e70208aef
commit 78d7227471
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
7 changed files with 75 additions and 1 deletions

17
gaming.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
assertions = [
{
assertion = config.services.xserver.enable;
message = "Gaming does not work without a desktop!";
}
];
programs = {
steam = {
enable = true;
extraCompatPackages = [ pkgs.proton-ge-bin ];
};
gamemode.enable = true;
};
}

View file

@ -0,0 +1,16 @@
{ config, pkgs, ... }:
{
hardware = {
graphics.enable = true;
nvidia = {
open = true;
forceFullCompositionPipeline = true;
};
};
services = {
xserver = pkgs.lib.mkIf config.services.xserver.enable {
videoDrivers = [ "nvidia" ];
};
};
}

25
machine-confs/gaming.nix Normal file
View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
networking.hostName = "gaming";
imports = [
../base.nix
../users/vili.nix
../desktop.nix
../gaming.nix
../services/sunshine.nix
# ../hardware-specific/nvidia.nix
];
users.users.vili.hashedPasswordFile = pkgs.lib.mkForce null;
swapDevices = pkgs.lib.mkForce [
{
device = "/var/lib/swapfile";
size = 16 * 1024;
}
];
# HARDWARE SPECIFIC
services.qemuGuest.enable = true;
}

View file

@ -72,7 +72,7 @@
../onlykey.nix ../onlykey.nix
../services/syncthing.nix ../services/syncthing.nix
../services/redshift.nix ../services/redshift.nix
../services/game-streaming.nix ../services/moonlight.nix
../hardware-specific/keychron-q11.nix ../hardware-specific/keychron-q11.nix
../hardware-specific/trackball.nix ../hardware-specific/trackball.nix
../hardware-specific/amd-laptop.nix ../hardware-specific/amd-laptop.nix

View file

@ -54,6 +54,7 @@
../onlykey.nix ../onlykey.nix
../services/syncthing.nix ../services/syncthing.nix
../services/redshift.nix ../services/redshift.nix
../services/moonlight.nix
../hardware-specific/keychron-q11.nix ../hardware-specific/keychron-q11.nix
../hardware-specific/trackball.nix ../hardware-specific/trackball.nix
../hardware-specific/usb-automount.nix ../hardware-specific/usb-automount.nix

15
services/sunshine.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, ... }:
{
assertions = [
{
assertion = config.services.xserver.enable;
message = "Game streaming does not work without a desktop!";
}
];
services.sunshine = {
enable = true;
autoStart = true;
openFirewall = true;
};
}