Kodi: Difference between revisions

From NixOS Wiki
imported>Jostgrant
Add `services.xserver.displayManager.lightdm.autoLogin.timeout = 3;` To Fix Lightdm's Autologin Ignore Issue On 22.11.
imported>Dschrempf
m Capitalize Kodi
Line 3: Line 3:
== Basic module usage ==
== Basic module usage ==


The NixOS module for kodi sets kodi up as a desktop session.
The NixOS module for Kodi sets Kodi up as a desktop session.
With this configuration kodi will run automatically on boot:
With this configuration Kodi will run automatically on boot:


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
Line 25: Line 25:
== Access from other machines ==
== Access from other machines ==


For this to work kodi's remote interface must be enabled in the kodi configuration.
For this to work Kodi's remote interface must be enabled in the Kodi configuration.
Kodi uses by default udp/tcp port 8080, which must be allowed in the firewall:
Kodi uses by default udp/tcp port 8080, which must be allowed in the firewall:


Line 37: Line 37:
</syntaxHighlight>
</syntaxHighlight>


== With wayland ==
== With Wayland ==


Especially on less-powerful ARM boards the wayland variant is faster.
Especially on less-powerful ARM boards the wayland variant is faster.
In this example cage, kiosk compositor for Wayland, will run kodi as its only application:
In this example cage, kiosk compositor for Wayland, will run Kodi as its only application:


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>

Revision as of 15:59, 29 November 2023

Kodi (formerly known as XBMC) is an award-winning free and open source (GPL) software media player and entertainment hub that can be installed on Linux, OSX, Windows, iOS and Android, featuring a 10-foot user interface for use with televisions and remote controls.

Basic module usage

The NixOS module for Kodi sets Kodi up as a desktop session. With this configuration Kodi will run automatically on boot:

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

 # This may be needed to force Lightdm into 'autologin' mode.
 # Setting an integer for the amount of time lightdm will wait
 # between attempts to try to autologin again. 
  services.xserver.displayManager.lightdm.autoLogin.timeout = 3;

  # Define a user account
  users.extraUsers.kodi.isNormalUser = true;
}

Access from other machines

For this to work Kodi's remote interface must be enabled in the Kodi configuration. Kodi uses by default udp/tcp port 8080, which must be allowed in the firewall:

{
  networking.firewall = {
    allowedTCPPorts = [ 8080 ];
    allowedUDPPorts = [ 8080 ];
  };
}

With Wayland

Especially on less-powerful ARM boards the wayland variant is faster. In this example cage, kiosk compositor for Wayland, will run Kodi as its only application:

{ pkgs, ... }: {
  # Define a user account
  users.extraUsers.kodi.isNormalUser = true;
  services.cage.user = "kodi";
  services.cage.program = "${pkgs.kodi-wayland}/bin/kodi-standalone";
  services.cage.enable = true;
}

Plugins

There are two different ways to install plugins. You can either set the relevant option (search pkgs/top-level/all-packages.nix for "wrapKodi" for a list) through NixOS or home-manager:

nixpkgs.config.kodi.enableAdvancedLauncher = true;

or override Kodi to include the plugins (see pkgs/applications/video/kodi/plugins.nix for a list or search in the kodiPlugins namespace):

environment.systemPackages = [
	(pkgs.kodi.passthru.withPackages (kodiPkgs: with kodiPkgs; [
		jellyfin
	]))
];