nix-files/hosts/common/programs/rtkit.nix

27 lines
1.0 KiB
Nix
Raw Normal View History

# rtkit/RealtimeKit: allow applications which want realtime audio (e.g. Dino? Pulseaudio server?) to request it.
# this might require more configuration (e.g. polkit-related) to work exactly as desired.
# - readme outlines requirements: <https://github.com/heftig/rtkit>
# XXX(2023/10/12): rtkit does not play well on moby. any application sending audio out dies after 10s.
# - note that `rtkit-daemon` can be launched with a lot of config
# - suggest using a much less aggressive canary. maybe try that?
# - see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Performance-tuning>
{ config, lib, ... }:
let
cfg = config.sane.programs.rtkit;
in
{
sane.programs.rtkit = {
services.rtkit = {
description = "rtkit: grant realtime scheduling privileges to select processes";
command = "${cfg.package}/libexec/rtkit-daemon";
};
};
environment.systemPackages = lib.mkIf cfg.enabled [
cfg.package # "to make polkit pickup rtkit policies". TODO: needed?
];
security.polkit = lib.mkIf cfg.enabled {
enable = true;
};
}