From 6ca6bc410607e3121698b28f53ae356668162a62 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 12 Aug 2025 19:32:38 -0500 Subject: [PATCH] add sunshine --- .../configuration/homebox/default.nix | 3 +- .../services/containers/sandbox/default.nix | 4 +- .../services/containers/sunshine/default.nix | 97 +++++++++++++++++++ system-config/services/sunshine/default.nix | 18 ++++ 4 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 system-config/services/containers/sunshine/default.nix create mode 100644 system-config/services/sunshine/default.nix diff --git a/system-config/configuration/homebox/default.nix b/system-config/configuration/homebox/default.nix index 005091e..bbbed5a 100644 --- a/system-config/configuration/homebox/default.nix +++ b/system-config/configuration/homebox/default.nix @@ -219,7 +219,8 @@ novnc.enable = true; minecraft.enable = false; #wont connect - sandbox.enable = true; + sandbox.enable = false; + sunshine.enable = true; }; }; }; diff --git a/system-config/services/containers/sandbox/default.nix b/system-config/services/containers/sandbox/default.nix index ba233f5..df89b17 100644 --- a/system-config/services/containers/sandbox/default.nix +++ b/system-config/services/containers/sandbox/default.nix @@ -20,12 +20,12 @@ config = lib.mkIf config.sysconfig.opts.virtualization.sandbox.enable { - containers.sandbox-test = { + containers.sandbox = { autoStart = true; privateNetwork = true; hostAddress = "192.168.100.10"; - localAddress = "192.168.100.31"; + localAddress = "192.168.100.32"; ephemeral = true; diff --git a/system-config/services/containers/sunshine/default.nix b/system-config/services/containers/sunshine/default.nix new file mode 100644 index 0000000..404b267 --- /dev/null +++ b/system-config/services/containers/sunshine/default.nix @@ -0,0 +1,97 @@ +{ config, lib, pkgs, ... }: { + + options.sysconfig.opts.virtualization.sunshine.enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + config = lib.mkIf config.sysconfig.opts.virtualization.sunshine.enable { + + containers.sunshine = { + + autoStart = true; + privateNetwork = true; + hostAddress = "192.168.100.10"; + localAddress = "192.168.100.31"; + + config = { + + services.sunshine = { + enable = true; + + autoStart = true; + + openFirewall = true; + }; + + system.stateVersion = "25.05"; + }; + + bindMounts = { + "/dev/nvidia0" = { + hostPath = "/dev/nvidia0"; + isReadOnly = false; + }; + "/dev/nvidiactl" = { + hostPath = "/dev/nvidiactl"; + isReadOnly = false; + }; + "/dev/nvidia-uvm" = { + hostPath = "/dev/nvidia-uvm"; + isReadOnly = false; + }; + "/dev/nvidia-modeset" = { + hostPath = "/dev/nvidia-modeset"; + isReadOnly = false; + }; + "/dev/nvidia-uvm-tools" = { + hostPath = "/dev/nvidia-uvm-tools"; + isReadOnly = false; + }; + "/dev/dri" = { + hostPath = "/dev/dri"; + isReadOnly = false; + }; + }; + + allowedDevices = [ + { + node = "/dev/nvidia0"; + modifier = "rw"; + } + { + node = "/dev/nvidiactl"; + modifier = "rw"; + } + { + node = "/dev/nvidia-uvm"; + modifier = "rw"; + } + { + node = "/dev/nvidia-modeset"; + modifier = "rw"; + } + { + node = "/dev/nvidia-uvm-tools"; + modifier = "rw"; + } + { + node = "/dev/dri/card0"; + modifier = "rw"; + } + { + node = "/dev/dri/card1"; + modifier = "rw"; + } + { + node = "/dev/dri/renderD128"; + modifier = "rw"; + } + { + node = "/dev/dri/renderD129"; + modifier = "rw"; + } + ]; + }; + }; +} diff --git a/system-config/services/sunshine/default.nix b/system-config/services/sunshine/default.nix new file mode 100644 index 0000000..7f62fb2 --- /dev/null +++ b/system-config/services/sunshine/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: { + + options.sysconfig.opts.sunshine.enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + + config = lib.mkIf config.sysconfig.opts.sunshine.enable { + + services.sunshine = { + enable = true; + + autoStart = true; + + openFirewall = true; + }; + }; +}