added config file for nixos

This commit is contained in:
kenji
2025-07-23 16:30:16 -05:00
parent c83ad31922
commit 9a44776d59
+43
View File
@@ -0,0 +1,43 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.programs.sunshine;
in {
options.programs.sunshine = with lib; {
enable = mkEnableOption "sunshine";
};
config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPortRanges = [
{
from = 47984;
to = 48010;
}
];
networking.firewall.allowedUDPPortRanges = [
{
from = 47998;
to = 48010;
}
];
security.wrappers.sunshine = {
owner = "root";
group = "root";
capabilities = "cap_sys_admin+p";
source = "${pkgs.sunshine}/bin/sunshine";
};
systemd.user.services.sunshine = {
description = "Sunshine self-hosted game stream host for Moonlight";
startLimitBurst = 5;
startLimitIntervalSec = 500;
serviceConfig = {
ExecStart = "${config.security.wrapperDir}/sunshine";
Restart = "on-failure";
RestartSec = "5s";
};
};
};
}