onenetbook/4: fix accelerometer

This commit is contained in:
Alexander Sosedkin 2021-06-06 20:13:16 +02:00
parent adfa06e0a9
commit 9a4e7bdd2a
1 changed files with 32 additions and 1 deletions

View File

@ -1,5 +1,9 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, ... }:
let
iio-sensor-proxy-supports-rotation =
lib.versionAtLeast pkgs.iio-sensor-proxy.version "3.0";
in
{
imports = [
../../common/cpu/intel
@ -18,4 +22,31 @@
boot.extraModulePackages = [
(config.boot.kernelPackages.callPackage ./goodix-stylus-mastykin {})
];
# OneNetbook 4 has an accelerometer,
hardware.sensor.iio.enable = lib.mkDefault iio-sensor-proxy-supports-rotation;
# said accelerometer needs rotation, rotation needs iio-sensor-proxy >= 3.0
services.udev.extraHwdb = lib.mkIf iio-sensor-proxy-supports-rotation ''
acpi:BOSC0200:BOSC0200:*
ACCEL_MOUNT_MATRIX=0, 1, 0; 0, 0, 1; 1, 0, 0
'';
# (this at least gets normal/left-up/right-up/bottom-up right)
# Until https://github.com/NixOS/nixpkgs/pull/125989 reaches you, you can use
#nixpkgs.overlays = [
# (self: super: {
# iio-sensor-proxy =
# if (lib.versionOlder super.iio-sensor-proxy.version "3.0") then
# (super.iio-sensor-proxy.overrideAttrs (oa: rec {
# version = "3.0";
# src = pkgs.fetchFromGitLab {
# domain = "gitlab.freedesktop.org";
# owner = "hadess";
# repo = "iio-sensor-proxy";
# rev = version;
# sha256 = "0ngbz1vkbjci3ml6p47jh6c6caipvbkm8mxrc8ayr6vc2p9l1g49";
# };
# }))
# else super.iio-sensor-proxy;
# })
#];
}