nixos/rtkit: refactor
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
# A module for ‘rtkit’, a DBus system service that hands out realtime
|
||||
# scheduling priority to processes that ask for it.
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
@@ -8,20 +5,13 @@
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.security.rtkit;
|
||||
package = pkgs.rtkit;
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
security.rtkit.enable = mkOption {
|
||||
type = types.bool;
|
||||
options.security.rtkit = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable the RealtimeKit system service, which hands
|
||||
@@ -31,8 +21,10 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
security.rtkit.args = mkOption {
|
||||
type = types.listOf types.str;
|
||||
package = lib.mkPackageOption pkgs "rtkit" { };
|
||||
|
||||
args = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Command-line options for `rtkit-daemon`.
|
||||
@@ -42,25 +34,23 @@ in
|
||||
"--max-realtime-priority=28"
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
security.polkit.enable = true;
|
||||
|
||||
# To make polkit pickup rtkit policies
|
||||
environment.systemPackages = [ package ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
services.dbus.packages = [ package ];
|
||||
services.dbus.packages = [ cfg.package ];
|
||||
|
||||
systemd.packages = [ package ];
|
||||
systemd.packages = [ cfg.package ];
|
||||
|
||||
systemd.services.rtkit-daemon = {
|
||||
serviceConfig = {
|
||||
ExecStart = [
|
||||
"" # Resets command from upstream unit.
|
||||
"${package}/libexec/rtkit-daemon ${utils.escapeSystemdExecArgs cfg.args}"
|
||||
"${cfg.package}/libexec/rtkit-daemon ${utils.escapeSystemdExecArgs cfg.args}"
|
||||
];
|
||||
|
||||
# Needs to verify the user of the processes.
|
||||
@@ -104,7 +94,5 @@ in
|
||||
description = "RealtimeKit daemon";
|
||||
};
|
||||
users.groups.rtkit = { };
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user