Skip to content

Commit

Permalink
nixos/ultraleap: init
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 8110b33 commit 2d7aef9
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@

- [tiny-dfr](https://github.com/WhatAmISupposedToPutHere/tiny-dfr), a dynamic function row daemon for the Touch Bar found on some Apple laptops. Available as [hardware.apple.touchBar.enable](options.html#opt-hardware.apple.touchBar.enable).

- [Ultraleap Hand Tracking](https://docs.ultraleap.com/), a userspace driver for Ultraleap Motion Controller hardware. Available as [services.ultraleap](#opt-services.ultraleap.enable) and integrates into Monado as [services.monado.enableUltraleap](#opt-services.monado.enableUltraleap)

## Backward Incompatibilities {#sec-release-24.11-incompatibilities}

- The `sound` options have been removed or renamed, as they had a lot of unintended side effects. See [below](#sec-release-24.11-migration-sound) for details.
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@
./services/hardware/tuxedo-rs.nix
./services/hardware/udev.nix
./services/hardware/udisks2.nix
./services/hardware/ultraleap.nix
./services/hardware/undervolt.nix
./services/hardware/upower.nix
./services/hardware/usbmuxd.nix
Expand Down
62 changes: 62 additions & 0 deletions nixos/modules/services/hardware/ultraleap.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{ config
, lib
, pkgs
, ...
}:
let
inherit (lib) getExe' mkDefault mkEnableOption mkIf mkPackageOption;

cfg = config.services.ultraleap;
in
{
options.services.ultraleap = {
enable = mkEnableOption "Ultraleap hand tracking service";

servicePackage = mkPackageOption pkgs "ultraleap-hand-tracking-service" { };
layerPackage = mkPackageOption pkgs "openxr-ultraleap-layer" { };
};

config = mkIf cfg.enable {
services.udev.packages = [ cfg.servicePackage ];

systemd.tmpfiles.settings."10-ultraleap"."/etc/ultraleap".d = {
user = "leap";
group = "leap";
mode = "0755";
};

systemd.services."ultraleap-hand-tracking-service" = {
description = "Ultraleap Tracking Service";
after = ["network.target"];
wantedBy = ["multi-user.target"];

environment = {
"LIBTRACK_IS_SERVICE" = mkDefault "1";
};

serviceConfig = {
Type = "exec";
ExecStart = getExe' cfg.servicePackage "leapd";
User = "leap";
Group = "leap";
KillMode = "process";
KillSignal = "SIGINT";
Restart = "on-failure";
LogsDirectory = "leap";
};
};

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

users.users.leap = {
isSystemUser = true;
group = "leap";
# udev rules from -service grant access to plugdev
extraGroups = ["plugdev"];
};
users.groups.leap = {};
};

meta.maintainers = with lib.maintainers; [ Scrumplex pandapip1 ];
}

0 comments on commit 2d7aef9

Please sign in to comment.