From 2d2493b23dc35f552e13f6022b0ec4b2a4cdc7b1 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 18 Dec 2023 16:55:02 +0100 Subject: [PATCH] nixos/monado: add option to make Monado the default OpenXR runtime Signed-off-by: Sefa Eyeoglu --- nixos/modules/services/hardware/monado.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/hardware/monado.nix b/nixos/modules/services/hardware/monado.nix index 9933d905584f..09895bfab2f0 100644 --- a/nixos/modules/services/hardware/monado.nix +++ b/nixos/modules/services/hardware/monado.nix @@ -4,15 +4,28 @@ , ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkPackageOption; + inherit (lib) mkDefault mkEnableOption mkIf mkOption mkPackageOption types; cfg = config.services.monado; + in { options.services.monado = { enable = mkEnableOption "Monado wrapper and user service"; package = mkPackageOption pkgs "monado" { }; + + defaultRuntime = mkOption { + type = types.bool; + description = '' + Whether to enable Monado as the default OpenXR runtime on the system. + + Note that applications can bypass this option by setting an active + runtime in a writable XDG_CONFIG_DIRS location like `~/.config`. + ''; + default = false; + example = true; + }; }; config = mkIf cfg.enable { @@ -70,6 +83,10 @@ in environment.systemPackages = [ cfg.package ]; environment.pathsToLink = [ "/share/openxr" ]; + + environment.etc."xdg/openxr/1/active_runtime.json" = mkIf cfg.defaultRuntime { + source = "${cfg.package}/share/openxr/1/openxr_monado.json"; + }; }; meta.maintainers = with lib.maintainers; [ Scrumplex ];