Merge pull request 'sunshine: add apps, improve uaccess rules' (#946) from a-kenji-imp/sunshine into main
This commit is contained in:
commit
2dd7304b57
@ -1,13 +1,41 @@
|
||||
{ pkgs, config, options, ... }:
|
||||
{ pkgs, options, ... }:
|
||||
let
|
||||
cfg = options.services.sunshine;
|
||||
apps = pkgs.writeText "apps.json" (builtins.toJSON
|
||||
{
|
||||
env = {
|
||||
PATH = "$(PATH):$(HOME)/.local/bin";
|
||||
};
|
||||
apps = [
|
||||
{
|
||||
name = "Desktop";
|
||||
image-path = "desktop.png";
|
||||
}
|
||||
{
|
||||
name = "Low Res Desktop";
|
||||
image-path = "desktop.png";
|
||||
prep-cmd = [
|
||||
{
|
||||
do = "xrandr --output HDMI-1 --mode 1920x1080";
|
||||
undo = "xrandr --output HDMI-1 --mode 1920x1200";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "Steam Big Picture";
|
||||
detached = [
|
||||
"setsid steam steam://open/bigpicture"
|
||||
];
|
||||
image-path = "steam.png";
|
||||
}
|
||||
];
|
||||
});
|
||||
sunshineConfiguration = pkgs.writeText "sunshine.conf" ''
|
||||
address_family = both
|
||||
channels = 5
|
||||
pkey = /var/lib/sunshine/sunshine.key
|
||||
cert = /var/lib/sunshine/sunshine.cert
|
||||
file_state = /var/lib/sunshine/state.json
|
||||
file_apps = /var/lib/sunshine/apps.json
|
||||
file_apps = ${apps}
|
||||
credentials_file = /var/lib/sunshine/credentials.json
|
||||
'';
|
||||
in
|
||||
@ -16,8 +44,7 @@ in
|
||||
enable = pkgs.lib.mkEnableOption "Sunshine self-hosted game stream host for Moonlight";
|
||||
};
|
||||
|
||||
config = pkgs.lib.mkMerge [
|
||||
(pkgs.lib.mkIf cfg.enable
|
||||
imports = [
|
||||
{
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
@ -68,12 +95,11 @@ in
|
||||
# Required to simulate input
|
||||
hardware.uinput.enable = true;
|
||||
boot.kernelModules = [ "uinput" ];
|
||||
# services.udev.extraRules = ''
|
||||
# KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
|
||||
# '';
|
||||
|
||||
services.udev.extraRules = ''
|
||||
KERNEL=="uinput", GROUP="input", MODE="0660" OPTIONS+="static_node=uinput"
|
||||
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
|
||||
'';
|
||||
|
||||
hardware.opengl.driSupport32Bit = true;
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
@ -109,8 +135,7 @@ in
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
}
|
||||
)
|
||||
]
|
||||
];
|
||||
# xdg.configFile."sunshine/apps.json".text = builtins.toJSON {
|
||||
# env = "/run/current-system/sw/bin";
|
||||
# apps = [
|
||||
@ -124,4 +149,4 @@ in
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user