Installing tuxedo-keyboard drivers

I recently switched to nixos and mostly ported my configs except for tuxedo-keyboard drivers, on my previous system I installed them this way:

git clone https://github .com/tuxedocomputers/tuxedo-keyboard ~
cd ~/tuxedo-keyboard
make && sudo make dkmsinstall
sudo modprobe tuxedo_keyboard

currently the keyboard backlight works until I close the lid, then it goes dark. I tried using

hardware.tuxedo-keyboard.enable = true;

but this caused to make my keyboard go dark on system boot instead of on closing lid, I also tried to play with these configs provided in man configuration.nix:

boot.kernelParams = [
“tuxedo_keyboard.mode=0”
“tuxedo_keyboard.brightness=255”
“tuxedo_keyboard.color_left=0xff0a0a”
];

but I haven’t had any success with those either.
Also note that I’m not using tuxedo laptop but gigabyte G5 instead, I haven’t had any problem with these drivers on previous system though

1 Like

Perhaps it’s because the packaged version is too old.
Currently in nixpkgs it is on 3.2.7, but upstream is at 4.2.2

Personally, I don’t have any problems, but my Tuxedo Pulse Gen 1 is an “older” Model that is supported by that Version.

So I’m gonna have to package the new version myself?

There is an alternative as mentioned: Keyboard backlight with Tuxedo Infinitybook Pro 16 but my backlight does not work.

Also note that I’m not using tuxedo laptop but gigabyte G5 instead, I haven’t had any problem with these drivers on previous system though

Well, since 3 days ago probably.
I am using the same laptop (G5 KF) with arch linux and since last update, my keyboard backlight stopped working and that kb.sh script now gives me this error:
make -j16 KERNELRELEASE=6.10.3-arch1-1 KDIR=/lib/modules/6.10.3-arch1-1/build…(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.10.3-arch1-1 (x86_64)
Consult /var/lib/dkms/tuxedo-keyboard/3.2.10/build/make.log for more information.
make: *** [Makefile:43: dkmsinstall] Error 10
modprobe: FATAL: Module tuxedo_keyboard not found in directory /lib/modules/6.10.3-arch1-1

Love the computer, but the backlight keyboard has been a headache since the beginning.

Edit: Fixed Arch Linux and Manjaro on TUXEDO computers - Arch Linux and Manjaro on TUXEDO computers - TUXEDO Computers
Installed other repositories that you may wanna check it out

I just received my Stellaris Slim 15 and ran into the same issue. They have moved their drivers to a different repository on GitLab. I know a decent amount about linux, a bit about Nix, but not a lot about kernel modules and nothing about being a nixpkgs maintainer. I have found a working solution though. If someone with some maintainer knowledge can check my work I am willing to fix this into nixpkgs with a pull-request (I am a developer, I do know git).

I got it working using the information on these pages

Note
One issue I ran into on my Stellaris laptop: it generates a systemd device for every key, and you need to update your default profile in tailor-gui so all these keys get a color profile. If you don’t, your keys will randomly flicker from color to color.

How to get it working in
You will need to remove any tuxedo-rs and tuxedo-keyboard settings from your config to prevent build collisions and add these 2 files to your nix config folder. Then include the tuxedo.nix in your configuration.nix.

This will build and include the kernel modules for tuxedo-keyboard and tuxedo-io. There are a lot more modules listed, and you can also include these if you have a system that needs these. See the commened list in tuxedo-drivers.nix


tuxedo.nix

{ config, pkgs, ... }:
let tuxedo-drivers = config.boot.kernelPackages.callPackage ./tuxedo-drivers.nix {};
in {
  boot.extraModulePackages = [ tuxedo-drivers ];
  boot.kernelModules = ["tuxedo_keyboard" "tuxedo-io" ];

  # We will compile and load this this in tuxedo-drivers.nix, enabling this would cause a collision during build
  hardware.tuxedo-keyboard.enable = false;

  services.dbus.packages = [ pkgs.tuxedo-rs ];
  environment.systemPackages = [ pkgs.tuxedo-rs pkgs.tailor-gui ];

  systemd = {
    services.tailord = {
      enable = true;
      description = "Tuxedo Tailor hardware control service";
      after = [ "systemd-logind.service" ];
      wantedBy = [ "multi-user.target" ];

      serviceConfig = {
        Type = "dbus";
        BusName = "com.tux.Tailor";
        ExecStart = "${pkgs.tuxedo-rs}/bin/tailord";
        Environment = "RUST_BACKTRACE=1";
        Restart = "on-failure";
      };
    };
  };
}

tuxedo-drivers.nix

{ stdenv, fetchFromGitLab, kernel }:

stdenv.mkDerivation rec {
  name = "tuxedo-drivers-${version}-${kernel.version}";
  version = "4.6.1";

  src = fetchFromGitLab {
    owner = "tuxedocomputers";
    repo = "development/packages/tuxedo-drivers";
    rev = "v${version}";
    sha256 = "sha256-hZ4fY6TQj4YIOzFH+iZq90VPr87KIzke4N2PiJGYeEE=";
  };

  makeFlags = [ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];

  /*
  Modules included in this repo:
    ite_8291/ite_8291
    ite_8291_lb/ite_8291_lb
    ite_8297/ite_8297
    ite_829x/ite_829x
    tuxedo_compatibility_check/tuxedo_compatibility_check
    tuxedo_io/tuxedo_io
    tuxedo_nb05/tuxedo_nb05_ec
    tuxedo_nb05/tuxedo_nb05_power_profiles
    tuxedo_nb05/tuxedo_nb05_sensors
    tuxedo_nb05/tuxedo_nb05_keyboard
    tuxedo_nb04/tuxedo_nb04_keyboard
    tuxedo_nb04/tuxedo_nb04_wmi_ab
    tuxedo_nb04/tuxedo_nb04_wmi_bs
    tuxedo_nb04/tuxedo_nb04_sensors
    tuxedo_nb04/tuxedo_nb04_power_profiles
    tuxedo_nb04/tuxedo_nb04_kbd_backlight
    tuxedo_keyboard
    clevo_acpi
    clevo_wmi
    uniwill_wmi

  To use these, add them to the for module .. list like so:
    for module in clevo_acpi.ko clevo_wmi.ko tuxedo_keyboard.ko "tuxedo_io/tuxedo_io.ko" uniwill_wmi.ko; do
  */
  installPhase = ''
    runHook preInstall

    mkdir -p "$out/lib/modules/${kernel.modDirVersion}"

    for module in tuxedo_keyboard.ko "tuxedo_io/tuxedo_io.ko"; do
        mv src/$module $out/lib/modules/${kernel.modDirVersion}
    done

    runHook postInstall
  '';
}