{ pkgs, config, lib, ... }:

with lib;

let
  cfg = config.settings.services.sunshine;
in {
  options = {
    settings.services.sunshine.enable = lib.mkOption {
      type = lib.types.bool;
      description = ''
        Enable sunshine service
      '';
    };
  };

  config = mkIf cfg.enable {
    services.sunshine = {
      enable = true;
      package = pkgs.unstable.sunshine.override { cudaSupport = true; };
      autoStart = true;
      capSysAdmin = true;
      openFirewall = true;
    };
  };
}
