HYAPQQOH67GIKQFGP45GE2DFC3WCQTAJUXHQDDK6FZQUGMZ2CZQQC
QNEDMAXXZFJJNFS2QHPEJZC6OHQEDC4GJBN5GM6G5INR2ME3WSZQC
F26DJCZ7RLGRDZSYACB6MGMNTW7L5FE332EBYEIJTBRK7QJ6ZIYAC
BYZGRIFZY253OFK442SR6X743U4LAX4NLFBQ4XPKXEDPPXNNUM4AC
ZGEGHEOD2S77CSNWOOFVB7Q3RGOU3WOWDOXJ4S2LKAS2JMS3UAZAC
H3GYCX27WTONFBIJN7UIV26LJSCENQJC4XXIOEYINXJLEDGKYJJQC
FH5X6FMOHRX5CZVY6P6X6BVQH5Q5C3XV6DGWR4QJZORAMFEXQHUQC
EVVP46IQ4U6JEDWVJ4D6KT77ABOMY7XKIO2ITX4DHJDRTGTYCUTQC
{
config,
pkgs,
lib,
...
}: let
cfg = config.services.sunshine;
in {
options.services.sunshine = with lib; {
enable = mkEnableOption "Sunshine server for Moonlight";
package = mkOption {
type = types.package;
default = pkgs.sunshine;
defaultText = literalExpression "pkgs.sunshine";
};
systemdTarget = mkOption {
type = types.str;
default = "graphical-session.target";
description = ''
Systemd target to bind to.
'';
};
};
config = mkIf cfg.enable {
services.udev = {
enable = mkDefault true;
extraRules = ''
KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
'';
};
systemd.user.services.sunshine = {
Unit.Description = ''
Sunshine self-hosted game stream host for Moonlight.
'';
Service = {
Type = "simple";
ExecStart = "${cfg.package}/bin/sunshine";
};
Install = {
WantedBy = [cfg.systemdTarget];
};
};
};
}
{...}: {
flake.nixosModules = {
sunshine = import ./sunshine.nix;
};
}
{
config,
pkgs,
lib,
...
}: let
cfg = config.services.sunshine;
in {
options.services.sunshine = with lib; {
enable = mkEnableOption "Sunshine server for Moonlight";
package = mkOption {
type = types.package;
default = pkgs.sunshine;
defaultText = literalExpression "pkgs.sunshine";
};
systemdTarget = mkOption {
type = types.str;
default = "graphical-session.target";
description = ''
Systemd target to bind to.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.sunshine" pkgs lib.platforms.linux)
];
systemd.user.services.sunshine = {
Unit.Description = ''
Sunshine self-hosted game stream host for Moonlight.
'';
Service = {
Type = "simple";
ExecStart = "${cfg.package}/bin/sunshine";
};
Install = {
WantedBy = [cfg.systemdTarget];
};
};
};
}