Kodi: Difference between revisions
imported>Dschrempf m Capitalize Kodi |
→Plugins: Add config with plugins for kodi-gbm setup example |
||
| (5 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
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. | [https://kodi.tv 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 == | == Basic module usage == | ||
| Line 6: | Line 6: | ||
With this configuration Kodi will run automatically on boot: | With this configuration Kodi will run automatically on boot: | ||
< | <syntaxhighlight lang="nix"> | ||
{ | { | ||
services.xserver.enable = true; | services.xserver.enable = true; | ||
| Line 13: | Line 13: | ||
services.xserver.displayManager.autoLogin.user = "kodi"; | services.xserver.displayManager.autoLogin.user = "kodi"; | ||
services.xserver.displayManager.lightdm.greeter.enable = false; | |||
services.xserver.displayManager.lightdm. | |||
# Define a user account | # Define a user account | ||
users.extraUsers.kodi.isNormalUser = true; | users.extraUsers.kodi.isNormalUser = true; | ||
} | } | ||
</ | </syntaxhighlight> | ||
== Access from other machines == | == Access from other machines == | ||
| Line 33: | Line 30: | ||
allowedTCPPorts = [ 8080 ]; | allowedTCPPorts = [ 8080 ]; | ||
allowedUDPPorts = [ 8080 ]; | allowedUDPPorts = [ 8080 ]; | ||
}; | |||
} | |||
</syntaxHighlight> | |||
== Autostart kodi-gbm, with HDMI audio passthrough == | |||
From ArchWiki: currently the most feature rich. It is the only one of the three options (x11, wayland, gbm) able to display HDR content, may be a good choice for standalone operations since it runs directly on the GPU without the need for the added X11 layer. A complete list of features lacking compared to other back-ends can be found in Kodi issue 14876. | |||
<syntaxHighlight lang=nix> | |||
{ pkgs, ... }: | |||
{ | |||
# use alsa; which supports hdmi passthrough | |||
services.pulseaudio.enable = false; | |||
services.pipewire.enable = false; | |||
environment.systemPackages = with pkgs; [ | |||
kodi-gbm | |||
]; | |||
users.users = { | |||
kodi = { | |||
initialHashedPassword = "passwordHash"; | |||
extraGroups = [ | |||
# allow kodi access to keyboards | |||
"input" | |||
]; | |||
isNormalUser = true; | |||
}; | |||
}; | |||
# auto-login and launch kodi | |||
services.getty.autologinUser = "kodi"; | |||
services.greetd = { | |||
enable = true; | |||
settings = { | |||
initial_session = { | |||
command = "${pkgs.kodi-gbm}/bin/kodi-standalone"; | |||
user = "kodi"; | |||
}; | |||
default_session = { | |||
command = "${pkgs.greetd.greetd}/bin/agreety --cmd sway"; | |||
}; | |||
}; | |||
}; | |||
programs.sway = { | |||
enable = true; | |||
xwayland.enable = false; | |||
}; | }; | ||
} | } | ||
| Line 54: | Line 101: | ||
== Plugins == | == 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: | 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: | |||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
| Line 60: | Line 109: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Or you can override Kodi to include the plugins (see pkgs/applications/video/kodi/plugins.nix for a list or search in the kodiPlugins namespace): | |||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
(pkgs.kodi | (pkgs.kodi.withPackages (kodiPkgs: with kodiPkgs; [ | ||
jellyfin | jellyfin | ||
])) | |||
]; | |||
</syntaxHighlight> | |||
When using the setup from the [[Kodi#Autostart kodi-gbm, with HDMI audio passthrough|kodi-gbm section above]], the plugins will not be available unless you use the same definition in the greetd command section. To make this easier, you can define the set as a variable like this and reference it later: | |||
<syntaxHighlight lang=nix> | |||
{ config, pkgs, ... }: | |||
let | |||
myKodi = (with pkgs; (kodi-gbm.withPackages (p: with p; [ | |||
jellycon | |||
]))); | |||
in | |||
{ | |||
# Replace occurences of kodi-gbm with myKodi, | |||
# specifically: | |||
environment.systemPackages = with pkgs; [ | |||
myKodi | |||
]; | |||
# and | |||
services.greetd.settings.initial_session.command = "${myKodi}/bin/kodi-standalone"; | |||
} | |||
</syntaxHighlight> | |||
Or if using as the startup desktop service: | |||
<syntaxHighlight lang=nix> | |||
services.xserver.desktopManager.kodi.package = | |||
pkgs.kodi.withPackages (pkgs: with pkgs; [ | |||
jellycon | |||
])) | ])) | ||
]; | ]; | ||
| Line 71: | Line 151: | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Server]] | |||