No, I really mean “hdapsd”.
hdapsd (pkgs/os-specific/linux/hdapsd/default.nix) package source code is at https://github.com/evgeni/hdapsd/releases/download/20141203/hdapsd-20141203.tar.gz .
Without the patch (or with “hdaps” as you suggest), I get
dmesg | grep -i hdaps
[ 15.086633] hdaps: supported laptop not found!
[ 15.086635] hdaps: driver init failed (ret=-19)!
[ 24.204814] audit: type=1130 audit(1551030602.203:74): pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=hdapsd@sda comm=“systemd” exe=“/nix/store/kinpd6wss80pf2d04jnvvmw25lzkrlbq-systemd-239/lib/systemd/systemd” hostname=? addr=? terminal=? res=success’
With this patch, I get:
dmesg | grep -i hdaps
[ 16.093667] hdaps: LENOVO ThinkPad X220 detected, setting orientation 4
[ 16.093764] hdaps: initial mode latch is 0x05
[ 16.093907] hdaps: setting ec_rate=250, filter_order=2
[ 16.094130] hdaps: device successfully initialized.
[ 16.094192] input: ThinkPad HDAPS joystick emulation as /devices/virtual/input/input6
[ 16.094220] input: ThinkPad HDAPS accelerometer data as /devices/virtual/input/input7
[ 16.094221] hdaps: driver successfully loaded.
[ 24.919059] audit: type=1130 audit(1551029327.917:73): pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=hdapsd@sda comm=“systemd” exe=“/nix/store/kinpd6wss80pf2d04jnvvmw25lzkrlbq-systemd-239/lib/systemd/systemd” hostname=? addr=? terminal=? res=success’
Joystick and accelerometers are available, and hard disk protection is enabled.