summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs/moonlight-qt.nix
blob: e836869f2661c63be001822282c8becdad6a3622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.programs.moonlight-qt;
in
{
  options.programs.moonlight-qt = {
    enable = lib.mkEnableOption "Moonlight Qt, a client for playing your PC games on almost any device";

    package = lib.mkPackageOption pkgs "moonlight-qt" { };

    capSysNice = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Add the CAP_SYS_NICE capability to Moonlight Qt so that it may raise
        its scheduling priority.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = [ cfg.package ];

    security.wrappers.moonlight = lib.mkIf cfg.capSysNice {
      owner = "root";
      group = "root";
      source = lib.getExe cfg.package;
      capabilities = "cap_sys_nice+ep";
    };
  };

  meta.maintainers = with lib.maintainers; [ aaravrav ];
}