forked from NixOS/nixos-hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensors.nix
44 lines (36 loc) · 1.27 KB
/
sensors.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ pkgs, lib, ... }:
{
# Enable IIO for brightness and accelerometer sensors
hardware.sensor.iio.enable = lib.mkDefault true;
services.fprintd.enable = lib.mkDefault true;
# Override ACPI DSDT to fix the accelerometer.
# A driver already exists for a similar sensor.
# This overrides the IDs to make the existing driver work.
# From Accelerometer on Linux https://github.com/mudkipme/awesome-minisforum-v3/issues/2#issuecomment-2279282784
boot.initrd.prepend =
let
minisforum-acpi-override = pkgs.stdenv.mkDerivation {
name = "minisforum-acpi-override";
CPIO_PATH = "kernel/firmware/acpi";
src = pkgs.callPackage ./src.nix {};
patches = [ ./dsdt.patch ];
nativeBuildInputs = with pkgs; [
acpica-tools
cpio
];
installPhase = ''
mkdir -p $CPIO_PATH
iasl -tc ./dsdt.dsl
cp ./dsdt.aml $CPIO_PATH
find kernel | cpio -H newc --create > acpi_override
cp acpi_override $out
'';
};
in
[ (toString minisforum-acpi-override) ];
# Fix inverted accelerometer rotation.
services.udev.extraHwdb = ''
sensor:modalias:acpi:SMO8B30*:dmi:*svnMicroComputer*:pnV3:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
'';
}