51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
#source: https://github.com/RandomNinjaAtk/nixos/blob/d2480c148e882f49e5caa6267060fd2d9e10af9b/services.sunshine.nix
|
|
#https://discourse.nixos.org/t/sunshine-self-hosted-game-stream/25608/16
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.sunshine;
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
|
|
services.sunshine = {
|
|
enable = mkEnableOption (mdDoc "Sunshine");
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf config.services.sunshine.enable {
|
|
|
|
environment.systemPackages = [
|
|
pkgs.sunshine
|
|
];
|
|
|
|
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 = "sunshine";
|
|
wantedBy = [ "graphical-session.target" ];
|
|
serviceConfig = {
|
|
ExecStart = "${config.security.wrapperDir}/sunshine";
|
|
};
|
|
};
|
|
|
|
};
|
|
}
|