From 00f0381893eb5c59334b33e9b4e835f9bd1e5f2a Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 19 Jul 2025 21:51:48 +0200 Subject: [PATCH] monado: Add amdgpu patch + disable for perso-desktop --- hosts/perso-desktop/configuration.nix | 2 -- hosts/perso-desktop/home.nix | 2 -- modules/system/services/monado.nix | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/hosts/perso-desktop/configuration.nix b/hosts/perso-desktop/configuration.nix index a797ad4..50ee3e6 100644 --- a/hosts/perso-desktop/configuration.nix +++ b/hosts/perso-desktop/configuration.nix @@ -55,8 +55,6 @@ printing.enable = true; steering-wheel.enable = true; }; - - services.monado.enable = true; }; chaotic.mesa-git = { diff --git a/hosts/perso-desktop/home.nix b/hosts/perso-desktop/home.nix index 72a2638..196e7fc 100644 --- a/hosts/perso-desktop/home.nix +++ b/hosts/perso-desktop/home.nix @@ -9,8 +9,6 @@ kitty.enable = true; }; - configs.monado.enable = true; - editors = { neovim.enable = true; vscode.enable = true; diff --git a/modules/system/services/monado.nix b/modules/system/services/monado.nix index 48605ca..045a523 100644 --- a/modules/system/services/monado.nix +++ b/modules/system/services/monado.nix @@ -2,6 +2,7 @@ with lib; let + cfgAmdgpu = config.modules.system.hardware.graphics.amdgpu; cfg = config.modules.system.services.monado; in { @@ -9,8 +10,15 @@ in enable = mkEnableOption '' Enable monado with my custom configurations ''; + + enableAmdgpuPatch = mkOption { + type = types.bool; + description = "Patch kernel to disable CAP_SYS_NICE on amdgpu. Required to allow high priority queues."; + default = cfgAmdgpu.enable; + }; }; config = mkIf cfg.enable { + # https://wiki.nixos.org/wiki/VR # https://github.com/NixOS/nixpkgs/issues/258196 services.monado = { enable = true; @@ -28,5 +36,16 @@ in XRT_COMPOSITOR_COMPUTE = "1"; WMR_HANDTRACKING = "0"; }; + + boot.kernelPatches = mkIf cfg.enableAmdgpuPatch [ + { + name = "amdgpu-ignore-ctx-privileges"; + patch = pkgs.fetchpatch { + name = "cap_sys_nice_begone.patch"; + url = "https://github.com/Frogging-Family/community-patches/raw/master/linux61-tkg/cap_sys_nice_begone.mypatch"; + hash = "sha256-Y3a0+x2xvHsfLax/uwycdJf3xLxvVfkfDVqjkxNaYEo="; + }; + } + ]; }; } \ No newline at end of file