summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Hedin Brønner <torhedinbronner@gmail.com>2019-10-19 15:38:04 +0200
committerTor Hedin Brønner <torhedinbronner@gmail.com>2019-10-19 17:14:38 +0200
commit927a6fdaad493044f2344cba73e6310d3450ca00 (patch)
tree04243cfc538c2b93b6a8bcbf796c3ab1344692d7
parentgnome3.mutter: drop inheritable cap_sys_nice (diff)
downloadnixpkgs-927a6fdaad493044f2344cba73e6310d3450ca00.tar.gz
nixos/gnome3: launch gnome-shell wayland with RT scheduling
We create a wrapper which launches gnome-shell with the correct environment and cap_sys_nice. We can then override gnome-shell-wayland.service to use this wrapper. NOTE: We need to force clear the environment, because the defaults aren't good for user services. That should probably be fixed.
-rw-r--r--nixos/modules/services/x11/desktop-managers/gnome3.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
index 9a402c74c052..1544a8420537 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome3.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -269,6 +269,26 @@ in
source-sans-pro
];
+ ## Enable soft realtime scheduling, only supported on wayland ##
+
+ security.wrappers.".gnome-shell-wrapped" = {
+ source = "${pkgs.gnome3.gnome-shell}/bin/.gnome-shell-wrapped";
+ capabilities = "cap_sys_nice=ep";
+ };
+
+ systemd.user.services.gnome-shell-wayland = let
+ gnomeShellRT = with pkgs.gnome3; pkgs.runCommand "gnome-shell-rt" {} ''
+ mkdir -p $out/bin/
+ cp ${gnome-shell}/bin/gnome-shell $out/bin
+ sed -i "s@${gnome-shell}/bin/@${config.security.wrapperDir}/@" $out/bin/gnome-shell
+ '';
+ in {
+ # Note we need to clear ExecStart before overriding it
+ serviceConfig.ExecStart = ["" "${gnomeShellRT}/bin/gnome-shell"];
+ # Do not use the default environment, it provides a broken PATH
+ environment = mkForce {};
+ };
+
# Adapt from https://gitlab.gnome.org/GNOME/gnome-build-meta/blob/gnome-3-32/elements/core/meta-gnome-core-shell.bst
environment.systemPackages = with pkgs.gnome3; [
adwaita-icon-theme