From NixOS Wiki

OpenTabletDriver is an open source, cross-platform, low latency, user-mode tablet driver.

Installing OpenTabletDriver

Install OpenTabletDriver, it's daemon and GUI by:

{ config, lib, pkgs, ... }:
  # Enable OpenTabletDriver
  hardware.opentabletdriver.enable = true;


Check out the official OpenTabletDriver Wiki

Warning: Do not run otd-daemon as root

But in case you do, run:

sudo rm /tmp/CoreFxPipe_OpenTabletDriver.Daemon

to stop the daemon from crashing when ran as user again.