nixos/monado: add option to make Monado the default OpenXR runtime

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-12-18 16:55:02 +01:00
parent ce36e73fdb
commit 2d2493b23d
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951

View File

@ -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 ];