refactor: change to litterate config
Configuration is now held by the `.org` files. All `.nix` files are tangled from the org-mode files.
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
{
|
||||
flake.modules.nixos.corne = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.mySystem.hardware.input.corne;
|
||||
in {
|
||||
options.mySystem.hardware.input.corne.allowHidAccess = mkEnableOption "Enable HID access to the corne keyboard";
|
||||
config.services.udev = mkIf cfg.allowHidAccess {
|
||||
extraRules = ''
|
||||
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
|
||||
'';
|
||||
};
|
||||
services.udev = {
|
||||
extraRules = ''
|
||||
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#+title: Corne Keyboard
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* Corne Keyboard
|
||||
I use a Corne (=crkbd=), a small split ergonomic keyboard, flashed with
|
||||
[[https://get.vial.today/][Vial]], a QMK-based firmware that lets me remap keys live from a GUI
|
||||
instead of having to reflash the keyboard every time I want to tweak
|
||||
my layout. Here’s the skeleton of the =nixos.corne= module.
|
||||
#+begin_src nix :tangle yes
|
||||
{
|
||||
flake.modules.nixos.corne = {
|
||||
<<udev-rule>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Granting HID Access
|
||||
By default, the =hidraw= device nodes created for the keyboard are only
|
||||
accessible to root, which means Vial can’t talk to it without running
|
||||
as root too. Instead, I add a =udev= rule matching my keyboard’s Vial
|
||||
identifier (the part after =vial:= is the keyboard’s unique unlock ID,
|
||||
burned into its firmware) and grant the =users= group read/write access
|
||||
to it, tagging it for =uaccess= / =udev-acl= so it’s also picked up by the
|
||||
logged-in session’s ACLs.
|
||||
#+name: udev-rule
|
||||
#+begin_src nix
|
||||
services.udev = {
|
||||
extraRules = ''
|
||||
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
|
||||
'';
|
||||
};
|
||||
#+end_src
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
flake.modules.nixos.disable-ibm-trackpoint = {
|
||||
services.udev.extraRules = ''
|
||||
ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#+title: Disable the IBM TrackPoint
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* Disable the IBM TrackPoint
|
||||
My ThinkPads come with IBM’s TrackPoint, the little red nub sitting
|
||||
between the =G=, =H= and =B= keys. I don’t want it active, though, it has a
|
||||
drift and I cannot fix it unless I change my keyboard. Thus, this
|
||||
module exposes a way to turn it off. Here’s the skeleton of the
|
||||
=nixos.disable-ibm-trackpoint= module.
|
||||
#+begin_src nix :tangle yes
|
||||
{
|
||||
flake.modules.nixos.disable-ibm-trackpoint = {
|
||||
<<udev-rule>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Disabling the TrackPoint
|
||||
The TrackPoint shows up to the input stack as a regular pointer
|
||||
device, so to disable it I can’t simply blacklist a driver — libinput
|
||||
and friends would still pick it up through =evdev=. Instead, I match it
|
||||
by its device name and clear the =ID_INPUT=, =ID_INPUT_MOUSE= and
|
||||
=ID_INPUT_POINTINGSTICK= udev properties on it, which tells the input
|
||||
stack to simply ignore the device as a pointing device.
|
||||
#+name: udev-rule
|
||||
#+begin_src nix
|
||||
services.udev.extraRules = ''
|
||||
ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
|
||||
'';
|
||||
#+end_src
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
flake.modules.nixos.ibm-trackpoint = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.mySystem.hardware.input.ibmTrackpoint;
|
||||
in {
|
||||
options.mySystem.hardware.input.ibmTrackpoint.disable = mkEnableOption "Disable IBM’s trackpoint on ThinkPad";
|
||||
config.services.udev = mkIf cfg.disable {
|
||||
extraRules = ''
|
||||
ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,19 +1,9 @@
|
||||
{
|
||||
flake.modules.nixos.opentablet = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.mySystem.hardware.input.opentablet;
|
||||
in {
|
||||
options.mySystem.hardware.input.opentablet.enable = mkEnableOption "Enables OpenTablet drivers";
|
||||
config = mkIf cfg.enable {
|
||||
hardware.opentabletdriver = {
|
||||
inherit (cfg) enable;
|
||||
daemon.enable = true;
|
||||
};
|
||||
boot.kernelModules = ["wacom"];
|
||||
};
|
||||
hardware.opentabletdriver = {
|
||||
enable = true;
|
||||
daemon.enable = true;
|
||||
};
|
||||
boot.kernelModules = ["wacom"];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#+title: OpenTabletDriver
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* OpenTabletDriver
|
||||
Some of my machines are hooked up to a graphics tablet, a Wacom
|
||||
Bamboo, driven by [[https://opentabletdriver.net/][OpenTabletDriver]]. I remember buying it for 15€, what
|
||||
a deal that was! Anyway, since most of my hosts don’t have a tablet
|
||||
attached, this is exposed as a regular toggle rather than enabled
|
||||
unconditionally. Here’s the skeleton of the =nixos.opentablet= module.
|
||||
#+begin_src nix :tangle yes
|
||||
{
|
||||
flake.modules.nixos.opentablet = {
|
||||
<<config>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Enabling the Driver
|
||||
Enabling OpenTabletDriver proper is just a matter of turning on the
|
||||
module and its daemon. I also need to explicitly load the =wacom=
|
||||
kernel module, since my tablet (like most of them) identifies itself
|
||||
as a Wacom device at the hardware level regardless of brand.
|
||||
#+name: config
|
||||
#+begin_src nix
|
||||
hardware.opentabletdriver = {
|
||||
enable = true;
|
||||
daemon.enable = true;
|
||||
};
|
||||
boot.kernelModules = ["wacom"];
|
||||
#+end_src
|
||||
@@ -0,0 +1,22 @@
|
||||
#+title: Trackball
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* Trackball
|
||||
I use a trackball on some of my machines, and I middle-click by
|
||||
pressing the left and right buttons together rather than through a
|
||||
dedicated button. That’s the only downside of the two trackballs I
|
||||
own; otherwise, I can’t recommend one enough. Here’s the
|
||||
=nixos.trackball= module enabling this behaviour.
|
||||
#+begin_src nix :tangle yes
|
||||
{
|
||||
flake.modules.nixos.trackball = {
|
||||
<<middle-emulation>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Enabling middle-click emulation is simple:
|
||||
#+name: middle-emulation
|
||||
#+begin_src nix
|
||||
services.libinput.mouse.middleEmulation = true;
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user