🚀 enable asus touchpad numpad

This commit is contained in:
Moritz Böhme 2022-04-18 12:20:04 +02:00
parent 26a7df41d8
commit a00798b058
No known key found for this signature in database
GPG key ID: 213820E2795F5CF5
3 changed files with 50 additions and 1 deletions

View file

@ -18,6 +18,22 @@
"type": "github"
}
},
"asus-touchpad-numpad-driver": {
"flake": false,
"locked": {
"lastModified": 1646981564,
"narHash": "sha256-qanPTmP2Sctq4ybiUFzIiADP2gZH8HhajBORUSIXb04=",
"owner": "mohamed-badaoui",
"repo": "asus-touchpad-numpad-driver",
"rev": "a2bada610ebb3fc002fceb53ddf93bc799241867",
"type": "github"
},
"original": {
"owner": "mohamed-badaoui",
"repo": "asus-touchpad-numpad-driver",
"type": "github"
}
},
"dracula-fish": {
"flake": false,
"locked": {
@ -303,6 +319,7 @@
"root": {
"inputs": {
"agenix": "agenix",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver",
"dracula-fish": "dracula-fish",
"emacs-overlay": "emacs-overlay",
"forgit-git": "forgit-git",

View file

@ -33,6 +33,12 @@
# VSCode plugin
nix-flake-tools.url = "github:rastertail/nix-flake-tools";
# Laptop Touchpad
asus-touchpad-numpad-driver = {
url = "github:mohamed-badaoui/asus-touchpad-numpad-driver";
flake = false;
};
};
outputs = inputs@{ self, agenix, home-manager, nixpkgs, utils, ... }:

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{ config, pkgs, inputs, ... }:
{
imports = [
@ -78,6 +78,32 @@
script = "${batteryLevelSufficient}/bin/battery-level-sufficient";
};
# Trackpad
# i2c for https://github.com/mohamed-badaoui/asus-touchpad-numpad-driver
hardware.i2c.enable = true;
systemd.services.asus-touchpad-numpad = {
description =
"Activate Numpad inside the touchpad with top right corner switch";
documentation =
[ "https://github.com/mohamed-badaoui/asus-touchpad-numpad-driver" ];
path = [ pkgs.i2c-tools ];
script = ''
cd ${inputs.asus-touchpad-numpad-driver}
# In the last argument here you choose your layout.
${
pkgs.python3.withPackages (ps: [ ps.libevdev ])
}/bin/python asus_touchpad.py m433ia
'';
# Probably needed because it fails on boot seemingly because the driver
# is not ready yet. Alternativly, you can use `sleep 3` or similar in the
# `script`.
serviceConfig = {
RestartSec = "1s";
Restart = "on-failure";
};
wantedBy = [ "multi-user.target" ];
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave