117 lines
3.7 KiB
Nix
117 lines
3.7 KiB
Nix
|
{ pkgs, fetchpatch, ... }:
|
||
|
|
||
|
let
|
||
|
commit = "f69eefacf7304857f8c0ce7ac0ebf4971121da72";
|
||
|
mkPatch = name: sha256: {
|
||
|
name = name;
|
||
|
patch = fetchpatch {
|
||
|
name = name + ".patch";
|
||
|
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/patches/5.13/${name}.patch";
|
||
|
sha256 = sha256;
|
||
|
};
|
||
|
};
|
||
|
in {
|
||
|
etc."ipts.conf".text = ''
|
||
|
[Config]
|
||
|
BlockOnPalm = true
|
||
|
'';
|
||
|
|
||
|
systemd.services.iptsd = {
|
||
|
description = "Userspace daemon for Intel Precise Touch & Stylus";
|
||
|
wantedBy = [ "multi-user.target" ];
|
||
|
wants = [ "dev-ipts-15.device" ];
|
||
|
after = [ "dev-ipts-15.device" ];
|
||
|
serviceConfig = {
|
||
|
Type = "simple";
|
||
|
ExecStart = "{pkgs.iptsd}/bin/iptsd";
|
||
|
};
|
||
|
};
|
||
|
environment.systemPackages = with pkgs; [ iptsd surface-control ];
|
||
|
services.udev.packages = with pkgs; [ iptsd surface-control ];
|
||
|
|
||
|
boot = {
|
||
|
kernelPackages = pkgs.linuxPackages_5_13;
|
||
|
kernelPatches = [
|
||
|
(mkPatch "0001-surface3-oemb" "0mvyjczylkkrdlqh8h9msl4mb0rzgkdjvnyjg7rg0ig7yiibg5r6")
|
||
|
(mkPatch "0002-mwifiex" "088gfc2skaizwz22bjha9a20pbn2isgbczy1khsgf7m4vpfhng39")
|
||
|
(mkPatch "0003-ath10k" "d5f388f2b1283d646788436c7b84c83b3bb7278fc5e7fe3b4cd99533763aad08")
|
||
|
(mkPatch "0004-ipts" "94295c2f4658a7b425697d2489ce393fb4281f8da6ce1bfba663ddcd8bb23ef6")
|
||
|
(mkPatch "0005-surface-sam-over-hid" "445da75d34a3e04164c2c20b7744f30a762ca4a9f3c29ad1832c11b8904f6c6b")
|
||
|
(mkPatch "0006-surface-sam" "098d84236e0ce65681bd32bab2924560175d71d286e98b9627bc6102100c71f9")
|
||
|
(mkPatch "0007-surface-hotplug" "e120b86aa48665099207de3c2fab4cb3384148dd818a9ab5949df2499d5be031")
|
||
|
(mkPatch "0008-surface-typecover" "2a0ad04bbe8661594a6cd3fff2a7a9e6e66243436b1fea8f3dcadef3b7a79fa7")
|
||
|
(mkPatch "0009-cameras" "8c9d687617cae1c78dbd18edead351c9f3cd4786b6da34f4a927e51261555f85")
|
||
|
(mkPatch "0010-amd-gpio" "8e30ff0ab332c05ec50e2d640a51888d8e6f0b1bb32b32a51efa1ea9ba676e06") # TODO: Maybe drop
|
||
|
(mkPatch "0011-amd-s0ix" "33173ef8da66eb3ebe0b96585c751e6dd064d0947aaac41a9de97d513a038e85") # TODO: Maybe drop
|
||
|
|
||
|
{
|
||
|
name = "surface-config";
|
||
|
patch = null;
|
||
|
# Options from https://github.com/linux-surface/linux-surface/blob/master/configs/surface-5.13.config
|
||
|
extraConfig = ''
|
||
|
#
|
||
|
# Surface Aggregator Module
|
||
|
#
|
||
|
CONFIG_SURFACE_AGGREGATOR=m
|
||
|
CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION=n
|
||
|
CONFIG_SURFACE_AGGREGATOR_BUS=y
|
||
|
CONFIG_SURFACE_AGGREGATOR_CDEV=m
|
||
|
CONFIG_SURFACE_AGGREGATOR_REGISTRY=m
|
||
|
|
||
|
CONFIG_SURFACE_ACPI_NOTIFY=m
|
||
|
CONFIG_SURFACE_DTX=m
|
||
|
CONFIG_SURFACE_PLATFORM_PROFILE=m
|
||
|
|
||
|
CONFIG_SURFACE_HID=m
|
||
|
CONFIG_SURFACE_KBD=m
|
||
|
|
||
|
CONFIG_BATTERY_SURFACE=m
|
||
|
CONFIG_CHARGER_SURFACE=m
|
||
|
|
||
|
#
|
||
|
# Surface Hotplug
|
||
|
#
|
||
|
CONFIG_SURFACE_HOTPLUG=m
|
||
|
|
||
|
#
|
||
|
# IPTS touchscreen
|
||
|
#
|
||
|
# This only enables the user interface for IPTS data.
|
||
|
# For the touchscreen to work, you need to install iptsd.
|
||
|
#
|
||
|
CONFIG_MISC_IPTS=m
|
||
|
|
||
|
#
|
||
|
# Cameras: IPU3
|
||
|
#
|
||
|
CONFIG_VIDEO_IPU3_IMGU=m
|
||
|
CONFIG_VIDEO_IPU3_CIO2=m
|
||
|
CONFIG_CIO2_BRIDGE=y
|
||
|
CONFIG_INTEL_SKL_INT3472=m
|
||
|
|
||
|
#
|
||
|
# Cameras: Sensor drivers
|
||
|
#
|
||
|
CONFIG_VIDEO_OV5693=m
|
||
|
CONFIG_VIDEO_OV8865=m
|
||
|
|
||
|
#
|
||
|
# ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
|
||
|
#
|
||
|
CONFIG_APDS9960=m
|
||
|
|
||
|
#
|
||
|
# Other Drivers
|
||
|
#
|
||
|
CONFIG_INPUT_SOC_BUTTON_ARRAY=m
|
||
|
CONFIG_SURFACE_3_BUTTON=m
|
||
|
CONFIG_SURFACE_3_POWER_OPREGION=m
|
||
|
CONFIG_SURFACE_PRO3_BUTTON=m
|
||
|
CONFIG_SURFACE_GPE=m
|
||
|
CONFIG_SURFACE_BOOK1_DGPU_SWITCH=m
|
||
|
'';
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
}
|