Trying to use Kodi with controllers/gamepads

Hello, I am trying to set up an entertainment system at my home, using Kodi. But it seems that I cannot use controllers/gamepads and I am not sure if I am missing something or need to install something.

Here is my config relevant to Kodi

  services.xserver = {
    enable = true;
    displayManager.autoLogin.user = "player";

    desktopManager.kodi.enable = true;

Kodi starts fine and works fine when using a keyboard, but not with controllers. I have tried with a dualshock 4 and stadia controller and it doesn’t work. What confuses me the most is that controllers normally works fine with desktopmanagers or windowmanagers, I have tried using both controllers in dwm and gnome and they work fine there.

I believe you need to actually configure each controller within kodi

Let me know if this does it for you:

I did try to do this, but it didn’t work. When I clicked to make it record the button to press, it still didn’t respond to me clicking the actual buttons.

You mean when you launch kodi from an environment which contains a window manager (on NixOS)?

On a related note I would recommend that you use a window manager like openbox for your HTPC setup if you will be gaming on it. Generally speaking I found it just works better. Without a window manager sometimes input is sent to the wrong window I seem to recall.

Yes, exactly.

Thanks, I am not really familiar with openbox or other wms for HTPCs. I have just tried using openbox, but I only get a grey screen with a cursor. I have also tried setting an autostart file to start kodi, but still nothing happens.
Do you have any other suggestions than openbox?

Here is my updated config:

  services.xserver = {
    enable = true;
    displayManager.autoLogin.user = "player";

    windowManager.openbox.enable = true;
    # desktopManager.kodi.enable = true;

  environment.systemPackages = with pkgs; [

  environment.etc."xdg/openbox/autostart".text = ''
    kodi &

Update: I tried launching kodi through SSH, but controllers still didn’t work, I have also checked settings that the controllers should be enabled.
I also tried launching supertuxkart from SSH where the controllers worked perfectly fine. So I am not wure what I am missing or doing wrong.

I got it working by installing the kodiPackages.joystick package:

  kodiWithPkgs = pkgs.kodi.withPackages (p: with p; [

Sorry I missed that one but I’m glad to see you got it resolved!

If you run into any issues with input going to the wrong application or think you might benefit from running a window manager this is my config for HTPC machines:

{ config, pkgs, lib, ... }:
  # Open ports in the firewall.
  networking.firewall.allowedTCPPorts = [
    8080 # kodi

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    # misc

  # Enable sound.
  hardware.pulseaudio.enable = true;

  # Enable 3D graphics.
  hardware.opengl.enable = true;
  hardware.opengl.driSupport = true;

  # List services that you want to enable:

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "htpc";

  # Enable Openbox
  services.xserver.displayManager.defaultSession = "none+openbox";
  services.xserver.windowManager.openbox.enable = true; = {
    description = "Kodi as systemd service";
    wantedBy = [ "" ];
    partOf = [ "" ];

    serviceConfig =
        package = pkgs.kodi.withPackages (p: with p; [

        ExecStart = "${package}/bin/kodi";
        Restart = "on-failure";

  # Define a user account. Don't forget to set a password with ‘mkpasswd -m sha-512’.
  users.users.htpc = {
    isNormalUser = true;
    group = "htpc";
    extraGroups = [ "dialout" ]; # libcec

  users.groups.htpc = {};

steam is also installed on my HTPC boxes but that configuration is provided by another .nix file.

1 Like