diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 3fbd21ee4f1d..6805a01ea1f7 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -12,6 +12,8 @@ - [tranquil](https://tangled.org/tranquil.farm/tranquil-pds) is an ATProto PDS (personal data server) implementation in Rust. A featureful, spec conscious and community driven alternative to the Bluesky reference implementation PDS. Available as [services.tranquil-pds](#opt-services.tranquil-pds.enable). +- [Moonlight Qt](https://moonlight-stream.org/), a client for playing your PC games on almost any device. Available as [programs.moonlight-qt](#opt-programs.moonlight-qt.enable). + - [scx_loader](https://github.com/sched-ext/scx-loader), a system daemon and DBus-based loader for sched_ext schedulers. `scxctl` is the command-line client for interacting with the loader, allowing users to switch schedulers, modes, and arguments dynamically. Available as [services.scx-loader](#opt-services.scx-loader.enable) - [Nezha](https://github.com/nezhahq/nezha), a self-hosted, lightweight server and website monitoring and O&M tool. Available as [services.nezha](#opt-services.nezha.enable). diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 692b4462c928..fe42710e1782 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -267,6 +267,7 @@ ./programs/mininet.nix ./programs/minipro.nix ./programs/miriway.nix + ./programs/moonlight-qt.nix ./programs/mosh.nix ./programs/mouse-actions.nix ./programs/msmtp.nix diff --git a/nixos/modules/programs/moonlight-qt.nix b/nixos/modules/programs/moonlight-qt.nix new file mode 100644 index 000000000000..e836869f2661 --- /dev/null +++ b/nixos/modules/programs/moonlight-qt.nix @@ -0,0 +1,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 ]; +} diff --git a/nixos/tests/sunshine.nix b/nixos/tests/sunshine.nix index e310b94df1a7..80f8e96b89eb 100644 --- a/nixos/tests/sunshine.nix +++ b/nixos/tests/sunshine.nix @@ -40,9 +40,10 @@ ./common/x11.nix ]; - environment.systemPackages = with pkgs; [ - moonlight-qt - ]; + programs.moonlight-qt = { + enable = true; + capSysNice = true; + }; }; @@ -52,6 +53,7 @@ # start the tests, wait for sunshine to be up start_all() sunshine.wait_for_open_port(48010,"localhost") + moonlight.succeed("${pkgs.libcap}/bin/getcap \"$(command -v moonlight)\" | grep -q 'cap_sys_nice'") # set the admin username/password, restart sunshine sunshine.execute("sunshine --creds sunshine sunshine")