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 Oct 27, 2024
1 parent 2d7aef9 commit 3e5dbfa
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 @@ -8,6 +8,7 @@ let

cfg = config.services.monado;

package = cfg.package.override {withUltraleap = cfg.enableUltraleap;};
in
{
options.services.monado = {
Expand All @@ -29,6 +30,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 @@ -38,11 +41,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 @@ -63,11 +70,11 @@ in
ExecStart =
if cfg.highPriority
then "${config.security.wrapperDir}/monado-service"
else lib.getExe' cfg.package "monado-service";
else lib.getExe' package "monado-service";
Restart = "no";
};

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

sockets.monado = {
Expand All @@ -84,17 +91,17 @@ in
FlushPending = true;
};

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

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

environment.systemPackages = [ cfg.package ];
environment.systemPackages = [ 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";
source = "${package}/share/openxr/1/openxr_monado.json";
};
};

Expand Down

0 comments on commit 3e5dbfa

Please sign in to comment.