nixos-conf/services/sunshine.nix
2025-01-11 18:04:00 +02:00

58 lines
1.3 KiB
Nix

{ pkgs, config, ... }:
let
resolution_list = [
"1920x1080"
"2400x1080"
"2160x1440"
"2560x1440"
"3840x2160"
];
in
{
assertions = [
{
assertion = config.services.xserver.enable;
message = "Game streaming does not work without a desktop!";
}
];
services.sunshine = {
enable = true;
autoStart = true;
openFirewall = true;
settings = {
sunshine_name = "Gaming NixOS";
resolutions = ''
[
1920x1080,
2400x1080,
2160x1440,
2560x1440,
3840x2160
]
'';
fps = ''
[30, 60, 90, 120]
'';
address_family = "both";
};
applications = {
apps =
(
resolutions:
map (resolution: {
name = "${resolution} Desktop";
# prep-cmd = [
# {
# do = "${pkgs.xrandr}/bin/kscreen-doctor output.DP-4.mode.2560x1440@144";
# undo = "${pkgs.xrandr}/bin/kscreen-doctor output.DP-4.mode.3440x1440@144";
# }
# ];
exclude-global-prep-cmd = "false";
auto-detach = "true";
}) resolutions
)
resolution_list;
};
};
}