From b59a89cb4cbec4cd26693dc5a1d7cdf3896bf14e Mon Sep 17 00:00:00 2001 From: Andre Date: Fri, 23 Aug 2024 10:56:14 -0400 Subject: [PATCH] Dimaga, Shura: add libinput quirks to detect keyboards as internal --- flake.lock | 6 +-- hosts/Dimaga/hardware-configuration.nix | 17 +++++++++ hosts/Shura/hardware-configuration.nix | 12 ++++++ overlays/mesa-latest.nix | 49 +++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 overlays/mesa-latest.nix diff --git a/flake.lock b/flake.lock index 0b10caf..eabf6ed 100644 --- a/flake.lock +++ b/flake.lock @@ -313,11 +313,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1724242322, - "narHash": "sha256-HMpK7hNjhEk4z5SFg5UtxEio9OWFocHdaQzCfW1pE7w=", + "lastModified": 1724316499, + "narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "224042e9a3039291f22f4f2ded12af95a616cca0", + "rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", "type": "github" }, "original": { diff --git a/hosts/Dimaga/hardware-configuration.nix b/hosts/Dimaga/hardware-configuration.nix index 2e59daf..d37971a 100644 --- a/hosts/Dimaga/hardware-configuration.nix +++ b/hosts/Dimaga/hardware-configuration.nix @@ -52,4 +52,21 @@ in }; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # Detect keyboard as "internal" so we can automatically disable the touchpad while typing + # If this doesn't work, try changing "MatchName" to "AT Raw Set 2 keyboard" + environment.etc."libinput/keyboard-touchpard.quirks" = { + mode = "0600"; + text = '' + [Microsoft Surface Type Cover Touchpad] + MatchUdevType=touchpad + MatchName=*Microsoft Surface Type Cover Touchpad + AttrKeyboardIntegration=internal + + [Microsoft Surface Type Cover Keyboard] + MatchUdevType=keyboard + MatchName=*Microsoft Surface Type Cover Keyboard + AttrKeyboardIntegration=internal + ''; + }; } diff --git a/hosts/Shura/hardware-configuration.nix b/hosts/Shura/hardware-configuration.nix index 368ec97..460c260 100644 --- a/hosts/Shura/hardware-configuration.nix +++ b/hosts/Shura/hardware-configuration.nix @@ -39,4 +39,16 @@ in size = 16384; }; }; + + # Detect keyboard as "internal" so we can automatically disable the touchpad while typing + # If this doesn't work, try changing "MatchName" to "AT Raw Set 2 keyboard" + environment.etc."libinput/keyboard-touchpard.quirks" = { + mode = "0600"; + text = '' + [Serial Keyboards] + MatchUdevType=keyboard + MatchName=ITE Tech. Inc. ITE Device(8258) Keyboard + AttrKeyboardIntegration=internal + ''; + }; } diff --git a/overlays/mesa-latest.nix b/overlays/mesa-latest.nix new file mode 100644 index 0000000..6c5a48f --- /dev/null +++ b/overlays/mesa-latest.nix @@ -0,0 +1,49 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + nixpkgs.overlays = [ + (self: super: { + mesa = super.callPackage ( + { lib, fetchurl }: + rec { + pname = "mesa"; + version = "24.1.4"; + + src = fetchurl { + urls = [ + "https://archive.mesa3d.org/mesa-${version}.tar.xz" + "https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz" + ]; + hash = "sha256-QJGDtgkLChOJP13v2Yl4NpeY8NUtheqWLN1HDkOLboU="; + }; + + meta = { + description = "Open source 3D graphics library"; + longDescription = '' + The Mesa project began as an open-source implementation of the OpenGL + specification - a system for rendering interactive 3D graphics. Over the + years the project has grown to implement more graphics APIs, including + OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API, XvMC, and + Vulkan. A variety of device drivers allows the Mesa libraries to be used + in many different environments ranging from software emulation to + complete hardware acceleration for modern GPUs. + ''; + homepage = "https://www.mesa3d.org/"; + changelog = "https://www.mesa3d.org/relnotes/${version}.html"; + license = with lib.licenses; [ mit ]; # X11 variant, in most files + platforms = lib.platforms.mesaPlatforms; + maintainers = with lib.maintainers; [ + primeos + vcunat + ]; # Help is welcome :) + }; + } + ) { }; + }) + ]; +}