mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 10:18:37 +02:00
feat: enable remote desktop - sunshine
This commit is contained in:
@@ -3,11 +3,11 @@
|
|||||||
mylib,
|
mylib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
# imports = mylib.scanPaths ./.;
|
imports = mylib.scanPaths ./.;
|
||||||
#
|
|
||||||
# environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# waypipe
|
waypipe
|
||||||
# moonlight-qt # moonlight client, for streaming games/desktop from a PC
|
moonlight-qt # moonlight client, for streaming games/desktop from a PC
|
||||||
# rustdesk # p2p remote desktop
|
rustdesk # p2p remote desktop
|
||||||
# ];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
# ===============================================================================
|
# ===============================================================================
|
||||||
#
|
#
|
||||||
# Sunshine: A self-hosted game stream server for Moonlight(Client).
|
# 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.
|
# 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/>):
|
# How to use(Web Console: <https://localhost:47990/>):
|
||||||
# https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/usage.html
|
# https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/usage.html
|
||||||
#
|
#
|
||||||
@@ -20,51 +12,14 @@
|
|||||||
# journalctl --user -u sunshine --since "2 minutes ago"
|
# journalctl --user -u sunshine --since "2 minutes ago"
|
||||||
#
|
#
|
||||||
# References:
|
# References:
|
||||||
# https://github.com/LongerHV/nixos-configuration/blob/c7a06a2125673c472946cda68b918f68c635c41f/modules/nixos/sunshine.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/modules/services/networking/sunshine.nix
|
||||||
# https://github.com/RandomNinjaAtk/nixos/blob/fc7d6e8734e6de175e0a18a43460c48003108540/services.sunshine.nix
|
|
||||||
#
|
#
|
||||||
# ===============================================================================
|
# ===============================================================================
|
||||||
{
|
{
|
||||||
security.wrappers.sunshine = {
|
services.sunshine = {
|
||||||
owner = "root";
|
enable = true;
|
||||||
group = "root";
|
autoStart = true;
|
||||||
capabilities = "cap_sys_admin+p";
|
capSysAdmin = true; # only needed for Wayland -- omit this when using with Xorg
|
||||||
source = "${pkgs.sunshine}/bin/sunshine";
|
openFirewall = true;
|
||||||
};
|
|
||||||
|
|
||||||
# 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;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user