mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-24 02:11:29 +01:00
feat: enable remote desktop - sunshine
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
mylib,
|
||||
...
|
||||
}: {
|
||||
# imports = mylib.scanPaths ./.;
|
||||
#
|
||||
# environment.systemPackages = with pkgs; [
|
||||
# waypipe
|
||||
# moonlight-qt # moonlight client, for streaming games/desktop from a PC
|
||||
# rustdesk # p2p remote desktop
|
||||
# ];
|
||||
imports = mylib.scanPaths ./.;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
waypipe
|
||||
moonlight-qt # moonlight client, for streaming games/desktop from a PC
|
||||
rustdesk # p2p remote desktop
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
# ===============================================================================
|
||||
#
|
||||
# Sunshine: A self-hosted game stream server for Moonlight(Client).
|
||||
# It's designed for game streaming, but it can be used for remote desktop as well.
|
||||
#
|
||||
# TODO: currently broken, fixed but not released yet: https://github.com/LizardByte/Sunshine/pull/1977
|
||||
#
|
||||
# How to use(Web Console: <https://localhost:47990/>):
|
||||
# https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/usage.html
|
||||
#
|
||||
@@ -20,51 +12,14 @@
|
||||
# journalctl --user -u sunshine --since "2 minutes ago"
|
||||
#
|
||||
# References:
|
||||
# https://github.com/LongerHV/nixos-configuration/blob/c7a06a2125673c472946cda68b918f68c635c41f/modules/nixos/sunshine.nix
|
||||
# https://github.com/RandomNinjaAtk/nixos/blob/fc7d6e8734e6de175e0a18a43460c48003108540/services.sunshine.nix
|
||||
# https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/modules/services/networking/sunshine.nix
|
||||
#
|
||||
# ===============================================================================
|
||||
{
|
||||
security.wrappers.sunshine = {
|
||||
owner = "root";
|
||||
group = "root";
|
||||
capabilities = "cap_sys_admin+p";
|
||||
source = "${pkgs.sunshine}/bin/sunshine";
|
||||
};
|
||||
|
||||
# Requires to simulate input
|
||||
boot.kernelModules = ["uinput"];
|
||||
services.udev.extraRules = ''
|
||||
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
|
||||
'';
|
||||
|
||||
# systemd.user.services.sunshine = {
|
||||
# description = "A self-hosted game stream server for Moonlight(Client)";
|
||||
# after = ["graphical-session-pre.target"];
|
||||
# wants = ["graphical-session-pre.target"];
|
||||
# wantedBy = ["graphical-session.target"];
|
||||
# startLimitIntervalSec = 500;
|
||||
# startLimitBurst = 5;
|
||||
#
|
||||
# serviceConfig = {
|
||||
# ExecStart = "${config.security.wrapperDir}/sunshine";
|
||||
# Restart = "on-failure";
|
||||
# RestartSec = "5s";
|
||||
# };
|
||||
# };
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPortRanges = [
|
||||
{
|
||||
from = 47984;
|
||||
to = 48010;
|
||||
}
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = 47998;
|
||||
to = 48010;
|
||||
}
|
||||
];
|
||||
services.sunshine = {
|
||||
enable = true;
|
||||
autoStart = true;
|
||||
capSysAdmin = true; # only needed for Wayland -- omit this when using with Xorg
|
||||
openFirewall = true;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user