From 927a6fdaad493044f2344cba73e6310d3450ca00 Mon Sep 17 00:00:00 2001 From: Tor Hedin Brønner Date: Sat, 19 Oct 2019 15:38:04 +0200 Subject: 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. --- .../modules/services/x11/desktop-managers/gnome3.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'nixos/modules') 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 -- cgit 1.4.1