Skip to content

Commit

Permalink
nixos/monado: add enableUltraleap option
Browse files Browse the repository at this point in the history
Signed-off-by: Sefa Eyeoglu <[email protected]>
  • Loading branch information
Scrumplex committed Nov 10, 2024
1 parent 55f864f commit 89e223c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions nixos/modules/services/hardware/monado.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let

cfg = config.services.monado;

package = cfg.package.override { withUltraleap = cfg.enableUltraleap; };
in
{
options.services.monado = {
Expand All @@ -38,6 +39,8 @@ in
highPriority =
mkEnableOption "high priority capability for monado-service"
// mkOption { default = true; };

enableUltraleap = mkEnableOption "Ultraleap hand tracking Monado driver and system service";
};

config = mkIf cfg.enable {
Expand All @@ -47,11 +50,15 @@ in
group = "root";
# cap_sys_nice needed for asynchronous reprojection
capabilities = "cap_sys_nice+eip";
source = lib.getExe' cfg.package "monado-service";
source = lib.getExe' package "monado-service";
};

services.udev.packages = with pkgs; [ xr-hardware ];

services.ultraleap = mkIf cfg.enableUltraleap {
enable = mkDefault true;
};

systemd.user = {
services.monado = {
description = "Monado XR runtime service module";
Expand All @@ -73,11 +80,11 @@ in
if cfg.highPriority then
"${config.security.wrapperDir}/monado-service"
else
lib.getExe' cfg.package "monado-service";
lib.getExe' package "monado-service";
Restart = "no";
};

restartTriggers = [ cfg.package ];
restartTriggers = [ package ];
};

sockets.monado = {
Expand All @@ -94,19 +101,19 @@ in
FlushPending = true;
};

restartTriggers = [ cfg.package ];
restartTriggers = [ package ];

wantedBy = [ "sockets.target" ];
};
};

environment.systemPackages = [ cfg.package ];
environment.systemPackages = [ package ];
environment.pathsToLink = [ "/share/openxr" ];

hardware.graphics.extraPackages = [ pkgs.monado-vulkan-layers ];

environment.etc."xdg/openxr/1/active_runtime.json" = mkIf cfg.defaultRuntime {
source = "${cfg.package}/share/openxr/1/openxr_monado.json";
source = "${package}/share/openxr/1/openxr_monado.json";
};
};

Expand Down

0 comments on commit 89e223c

Please sign in to comment.