From d51c7e255fec6296ea069cc7c65e7f0eef51b6f1 Mon Sep 17 00:00:00 2001 From: servius Date: Thu, 9 Apr 2026 21:14:26 +0530 Subject: [PATCH] feat: Added sunshine to ryu with a reverse proxy behind tailscale --- nixos/ryu/services/default.nix | 4 ++-- nixos/ryu/services/sunshine.nix | 29 ++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/nixos/ryu/services/default.nix b/nixos/ryu/services/default.nix index b1e4b1a..d512e58 100644 --- a/nixos/ryu/services/default.nix +++ b/nixos/ryu/services/default.nix @@ -3,7 +3,7 @@ # ./calibre.nix # ./dnscrypt.nix # ./rsyncd.nix - # ./sunshine.nix + # ./vllm.nix # ./zerotier.nix ./caddy.nix @@ -22,8 +22,8 @@ ./resolved.nix ./samba.nix ./sshd.nix + ./sunshine.nix ./tailscale.nix - # ./vllm.nix ./wivrn.nix ]; } diff --git a/nixos/ryu/services/sunshine.nix b/nixos/ryu/services/sunshine.nix index 52a6300..63e5297 100644 --- a/nixos/ryu/services/sunshine.nix +++ b/nixos/ryu/services/sunshine.nix @@ -1,4 +1,9 @@ -{pkgs, ...}: { +{ + pkgs, + device, + config, + ... +}: { systemd.user.services.sunshine.path = [ pkgs.gamemode pkgs.steam @@ -10,7 +15,7 @@ capSysAdmin = true; autoStart = true; settings = { - # file_apps = "/home/servius/.config/sunshine/apps.json"; + # file_apps = "${device.home}/.config/sunshine/apps.json"; sunshine_name = "Ryu"; }; applications = { @@ -20,22 +25,36 @@ name = "Steam Big Picture"; icon = "steam"; # detached = ["setsid steam steam://open/gamepadui"]; - detached = ["/run/wrappers/bin/sudo -u servius ${pkgs.util-linux}/bin/setsid ${pkgs.steam}/bin/steam steam://open/gamepadui"]; + detached = ["/run/wrappers/bin/sudo -u ${device.user} ${pkgs.util-linux}/bin/setsid ${pkgs.steam}/bin/steam steam://open/gamepadui"]; exclude-global-prep-cmd = "false"; auto-detach = "true"; } { name = "Baldur's Gate 3"; - image-path = "/home/servius/.config/sunshine/covers/igdb_119171.png"; + image-path = "${device.home}/.config/sunshine/covers/igdb_119171.png"; auto-detach = "true"; exclude-global-prep-cmd = "false"; prep-cmd = []; # detached = ["setsid steam steam://rungameid/1086940"]; - detached = ["/run/wrappers/bin/sudo -u servius ${pkgs.util-linux}/bin/setsid ${pkgs.steam}/bin/steam steam://rungameid/1086940"]; + detached = ["/run/wrappers/bin/sudo -u ${device.user} ${pkgs.util-linux}/bin/setsid ${pkgs.steam}/bin/steam steam://rungameid/1086940"]; wait-all = true; exit-timeout = 5; } ]; }; }; + + services.caddy.virtualHosts."sunshine.darksailor.dev".extraConfig = '' + import cloudflare + reverse_proxy localhost:${toString ( + config.services.sunshine.settings.port + 1 + /* + Webserver is offset 1 + */ + )} { + transport http { + tls_insecure_skip_verify + } + } + ''; } -- 2.51.2